java.net.socket api_Socket Class

Socket Class

Definition

Namespace:

Assembly:Mono.Android.dll

Provides a client-side TCP socket.

In this article

[Android.Runtime.Register("java/net/Socket", ApiSince=1, DoNotGenerateAcw=true)]

public class Socket : Java.Lang.Object, IDisposable, Java.IO.ICloseable

type Socket = class

inherit Object

interface ICloseable

interface IJavaObject

interface IDisposable

Inheritance

Remarks

Portions of this page are modifications based on work created and shared by the

Constructors

Creates a new unconnected socket.

Creates a new streaming socket connected to the target host specified by

the parameters dstAddress and dstPort.

Obsolete.

Creates a new streaming or datagram socket connected to the target host

specified by the parameters addr and port.

Creates a new streaming socket connected to the target host specified by

the parameters dstAddress and dstPort.

A constructor used when creating managed representations of JNI objects; called by the runtime.

Creates a new unconnected socket using the given proxy type.

Creates an unconnected socket with the given socket implementation.

Creates a new streaming socket connected to the target host specified by

the parameters dstName and dstPort.

Obsolete.

Creates a new streaming or datagram socket connected to the target host

specified by the parameters hostName and port.

Creates a new streaming socket connected to the target host specified by

the parameters dstName and dstPort.

Properties

Returns this socket's SocketChannel, if one exists.

Returns the unique instance of Class that represents this

object's class.

(Inherited from Object)

The handle to the underlying Android instance.

(Inherited from Object)

Returns the IP address of the target host this socket is connected to, or null if this

socket is not yet connected.

Returns an input stream to read data from this socket.

Returns whether this socket is bound to a local address and port.

Returns whether this socket is closed.

Returns whether this socket is connected to a remote host.

Returns whether the incoming channel of the socket has already been

closed.

Returns whether the outgoing channel of the socket has already been

closed.

Returns this socket's SoKeepalive setting.

Returns the local IP address this socket is bound to, or an address for which

IsAnyLocalAddress returns true if the socket is closed or unbound.

Returns the local port this socket is bound to, or -1 if the socket is unbound.

Returns the local address and port of this socket as a SocketAddress or null if the socket

has never been bound.

Returns this socket's SoOobinline setting.

Returns an output stream to write data into this socket.

Returns the port number of the target host this socket is connected to, or 0 if this socket

is not yet connected.

Returns the remote address and port of this socket as a SocketAddress or null if the socket is not connected.

Returns this socket's SoReuseaddr setting.

Returns this socket's SoSndbuf.

Returns this socket's SoLinger timeout in seconds, or -1

for no linger (i.e.

Returns this socket's SoTimeout.

Returns this socket's SocketOptions#TCP_NODELAY setting.

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Returns this socket's setting.

Methods

Binds this socket to the given local host address and port specified by

the SocketAddress localAddr.

Creates and returns a copy of this Object.

(Inherited from Object)

Closes the socket.

Connects this socket to the given remote host address and port specified

by the SocketAddress remoteAddr.

Connects this socket to the given remote host address and port specified

by the SocketAddress remoteAddr with the specified timeout.

(Inherited from Object)

Compares this instance with the specified object and indicates if they

are equal.

(Inherited from Object)

Returns an integer hash code for this object.

(Inherited from Object)

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)

Causes a thread which is waiting on this object's monitor (by means of

calling one of the wait() methods) to be woken up.

(Inherited from Object)

Causes all threads which are waiting on this object's monitor (by means

of calling one of the wait() methods) to be woken up.

(Inherited from Object)

Sends the given single byte data which is represented by the lowest octet

of value as "TCP urgent data".

Sets performance preferences for connectionTime, latency and bandwidth.

Sets the internal factory for creating socket implementations.

Sets this socket's SoLinger timeout in seconds.

Closes the input stream of this socket.

Closes the output stream of this socket.

Returns a string containing a concise, human-readable description of this

object.

(Inherited from Object)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the

specified timeout expires.

(Inherited from Object)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the

specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

Extension Methods

Applies to

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值