Socket Methods

The Socket type exposes the following members.

  Name Description
Public method Accept Creates a new Socket for a newly created connection.
Public method AcceptAsync Begins an asynchronous operation to accept an incoming connection attempt.
Public method BeginAccept(AsyncCallback, Object) Begins an asynchronous operation to accept an incoming connection attempt.
Public method BeginAccept(Int32, AsyncCallback, Object) Begins an asynchronous operation to accept an incoming connection attempt and receives the first block of data sent by the client application.
Public method BeginAccept(Socket, Int32, AsyncCallback, Object) Begins an asynchronous operation to accept an incoming connection attempt from a specified socket and receives the first block of data sent by the client application.
Public method BeginConnect(EndPoint, AsyncCallback, Object) Begins an asynchronous request for a remote host connection.
Public method BeginConnect(IPAddress, Int32, AsyncCallback, Object) Begins an asynchronous request for a remote host connection. The host is specified by an IPAddress and a port number.
Public method BeginConnect(IPAddress[], Int32, AsyncCallback, Object) Begins an asynchronous request for a remote host connection. The host is specified by an IPAddress array and a port number.
Public method BeginConnect(String, Int32, AsyncCallback, Object) Begins an asynchronous request for a remote host connection. The host is specified by a host name and a port number.
Public method BeginDisconnect Begins an asynchronous request to disconnect from a remote endpoint.
Public method BeginReceive(IList<ArraySegment<Byte>>, SocketFlags, AsyncCallback, Object) Begins to asynchronously receive data from a connected Socket.
Public method BeginReceive(IList<ArraySegment<Byte>>, SocketFlags, SocketError, AsyncCallback, Object) Begins to asynchronously receive data from a connected Socket.
Public method BeginReceive(Byte[], Int32, Int32, SocketFlags, AsyncCallback, Object) Begins to asynchronously receive data from a connected Socket.
Public method BeginReceive(Byte[], Int32, Int32, SocketFlags, SocketError, AsyncCallback, Object) Begins to asynchronously receive data from a connected Socket.
Public method BeginReceiveFrom Begins to asynchronously receive data from a specified network device.
Public method BeginReceiveMessageFrom Begins to asynchronously receive the specified number of bytes of data into the specified location of the data buffer, using the specified SocketFlags, and stores the endpoint and packet information..
Public method BeginSend(IList<ArraySegment<Byte>>, SocketFlags, AsyncCallback, Object) Sends data asynchronously to a connected Socket.
Public method BeginSend(IList<ArraySegment<Byte>>, SocketFlags, SocketError, AsyncCallback, Object) Sends data asynchronously to a connected Socket.
Public method BeginSend(Byte[], Int32, Int32, SocketFlags, AsyncCallback, Object) Sends data asynchronously to a connected Socket.
Public method BeginSend(Byte[], Int32, Int32, SocketFlags, SocketError, AsyncCallback, Object) Sends data asynchronously to a connected Socket.
Public method BeginSendFile(String, AsyncCallback, Object) Sends the file fileName to a connected Socket object using the UseDefaultWorkerThread flag.
Public method BeginSendFile(String, Byte[], Byte[], TransmitFileOptions, AsyncCallback, Object) Sends a file and buffers of data asynchronously to a connected Socket object.
Public method BeginSendTo Sends data asynchronously to a specific remote host.
Public method Bind Associates a Socket with a local endpoint.
Public method Static member CancelConnectAsync Cancels an asynchronous request for a remote host connection.
Public method Close() Closes the Socket connection and releases all associated resources.
Public method Close(Int32) Closes the Socket connection and releases all associated resources with a specified timeout to allow queued data to be sent.
Public method Connect(EndPoint) Establishes a connection to a remote host.
Public method Connect(IPAddress, Int32) Establishes a connection to a remote host. The host is specified by an IP address and a port number.
Public method Connect(IPAddress[], Int32) Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.
Public method Connect(String, Int32) Establishes a connection to a remote host. The host is specified by a host name and a port number.
Public method ConnectAsync(SocketAsyncEventArgs) Begins an asynchronous request for a connection to a remote host.
Public method Static member ConnectAsync(SocketType, ProtocolType, SocketAsyncEventArgs) Begins an asynchronous request for a connection to a remote host.
Public method Disconnect Closes the socket connection and allows reuse of the socket.
Public method DisconnectAsync Begins an asynchronous request to disconnect from a remote endpoint.
Public method Dispose() Releases all resources used by the current instance of the Socket class.
Protected method Dispose(Boolean) Releases the unmanaged resources used by the Socket, and optionally disposes of the managed resources.
Public method DuplicateAndClose Duplicates the socket reference for the target process, and closes the socket for this process.
Public method EndAccept(IAsyncResult) Asynchronously accepts an incoming connection attempt and creates a new Socket to handle remote host communication.
Public method EndAccept(Byte[], IAsyncResult) Asynchronously accepts an incoming connection attempt and creates a new Socket object to handle remote host communication. This method returns a buffer that contains the initial data transferred.
Public method EndAccept(Byte[], Int32, IAsyncResult) Asynchronously accepts an incoming connection attempt and creates a new Socket object to handle remote host communication. This method returns a buffer that contains the initial data and the number of bytes transferred.
Public method EndConnect Ends a pending asynchronous connection request.
Public method EndDisconnect Ends a pending asynchronous disconnect request.
Public method EndReceive(IAsyncResult) Ends a pending asynchronous read.
Public method EndReceive(IAsyncResult, SocketError) Ends a pending asynchronous read.
Public method EndReceiveFrom Ends a pending asynchronous read from a specific endpoint.
Public method EndReceiveMessageFrom Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than EndReceiveFrom.
Public method EndSend(IAsyncResult) Ends a pending asynchronous send.
Public method EndSend(IAsyncResult, SocketError) Ends a pending asynchronous send.
Public method EndSendFile Ends a pending asynchronous send of a file.
Public method EndSendTo Ends a pending asynchronous send to a specific location.
Public method Equals(Object) Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Frees resources used by the Socket class. (Overrides Object.Finalize().)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetSocketOption(SocketOptionLevel, SocketOptionName) Returns the value of a specified Socket option, represented as an object.
Public method GetSocketOption(SocketOptionLevel, SocketOptionName, Byte[]) Returns the specified Socket option setting, represented as a byte array.
Public method GetSocketOption(SocketOptionLevel, SocketOptionName, Int32) Returns the value of the specified Socket option in an array.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IOControl(Int32, Byte[], Byte[]) Sets low-level operating modes for the Socket using numerical control codes.
Public method IOControl(IOControlCode, Byte[], Byte[]) Sets low-level operating modes for the Socket using the IOControlCode enumeration to specify control codes.
Public method Listen Places a Socket in a listening state.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Poll Determines the status of the Socket.
Public method Receive(IList<ArraySegment<Byte>>) Receives data from a bound Socket into the list of receive buffers.
Public method Receive(Byte[]) Receives data from a bound Socket into a receive buffer.
Public method Receive(IList<ArraySegment<Byte>>, SocketFlags) Receives data from a bound Socket into the list of receive buffers, using the specified SocketFlags.
Public method Receive(Byte[], SocketFlags) Receives data from a bound Socket into a receive buffer, using the specified SocketFlags.
Public method Receive(IList<ArraySegment<Byte>>, SocketFlags, SocketError) Receives data from a bound Socket into the list of receive buffers, using the specified SocketFlags.
Public method Receive(Byte[], Int32, SocketFlags) Receives the specified number of bytes of data from a bound Socket into a receive buffer, using the specified SocketFlags.
Public method Receive(Byte[], Int32, Int32, SocketFlags) Receives the specified number of bytes from a bound Socket into the specified offset position of the receive buffer, using the specified SocketFlags.
Public method Receive(Byte[], Int32, Int32, SocketFlags, SocketError) Receives data from a bound Socket into a receive buffer, using the specified SocketFlags.
Public method ReceiveAsync Begins an asynchronous request to receive data from a connected Socket object.
Public method ReceiveFrom(Byte[], EndPoint) Receives a datagram into the data buffer and stores the endpoint.
Public method ReceiveFrom(Byte[], SocketFlags, EndPoint) Receives a datagram into the data buffer, using the specified SocketFlags, and stores the endpoint.
Public method ReceiveFrom(Byte[], Int32, SocketFlags, EndPoint) Receives the specified number of bytes into the data buffer, using the specified SocketFlags, and stores the endpoint.
Public method ReceiveFrom(Byte[], Int32, Int32, SocketFlags, EndPoint) Receives the specified number of bytes of data into the specified location of the data buffer, using the specified SocketFlags, and stores the endpoint.
Public method ReceiveFromAsync Begins to asynchronously receive data from a specified network device.
Public method ReceiveMessageFrom Receives the specified number of bytes of data into the specified location of the data buffer, using the specified SocketFlags, and stores the endpoint and packet information.
Public method ReceiveMessageFromAsync Begins to asynchronously receive the specified number of bytes of data into the specified location in the data buffer, using the specified SocketAsyncEventArgs.SocketFlags, and stores the endpoint and packet information.
Public method Static member Select Determines the status of one or more sockets.
Public method Send(IList<ArraySegment<Byte>>) Sends the set of buffers in the list to a connected Socket.
Public method Send(Byte[]) Sends data to a connected Socket.
Public method Send(IList<ArraySegment<Byte>>, SocketFlags) Sends the set of buffers in the list to a connected Socket, using the specified SocketFlags.
Public method Send(Byte[], SocketFlags) Sends data to a connected Socket using the specified SocketFlags.
Public method Send(IList<ArraySegment<Byte>>, SocketFlags, SocketError) Sends the set of buffers in the list to a connected Socket, using the specified SocketFlags.
Public method Send(Byte[], Int32, SocketFlags) Sends the specified number of bytes of data to a connected Socket, using the specified SocketFlags.
Public method Send(Byte[], Int32, Int32, SocketFlags) Sends the specified number of bytes of data to a connected Socket, starting at the specified offset, and using the specified SocketFlags.
Public method Send(Byte[], Int32, Int32, SocketFlags, SocketError) Sends the specified number of bytes of data to a connected Socket, starting at the specified offset, and using the specified SocketFlags
Public method SendAsync Sends data asynchronously to a connected Socket object.
Public method SendFile(String) Sends the file fileName to a connected Socket object with the UseDefaultWorkerThread transmit flag.
Public method SendFile(String, Byte[], Byte[], TransmitFileOptions) Sends the file fileName and buffers of data to a connected Socket object using the specified TransmitFileOptions value.
Public method SendPacketsAsync Sends a collection of files or in memory data buffers asynchronously to a connected Socket object.
Public method SendTo(Byte[], EndPoint) Sends data to the specified endpoint.
Public method SendTo(Byte[], SocketFlags, EndPoint) Sends data to a specific endpoint using the specified SocketFlags.
Public method SendTo(Byte[], Int32, SocketFlags, EndPoint) Sends the specified number of bytes of data to the specified endpoint using the specified SocketFlags.
Public method SendTo(Byte[], Int32, Int32, SocketFlags, EndPoint) Sends the specified number of bytes of data to the specified endpoint, starting at the specified location in the buffer, and using the specified SocketFlags.
Public method SendToAsync Sends data asynchronously to a specific remote host.
Public method SetIPProtectionLevel Set the IP protection level on a socket.
Public method SetSocketOption(SocketOptionLevel, SocketOptionName, Boolean) Sets the specified Socket option to the specified Boolean value.
Public method SetSocketOption(SocketOptionLevel, SocketOptionName, Byte[]) Sets the specified Socket option to the specified value, represented as a byte array.
Public method SetSocketOption(SocketOptionLevel, SocketOptionName, Int32) Sets the specified Socket option to the specified integer value.
Public method SetSocketOption(SocketOptionLevel, SocketOptionName, Object) Sets the specified Socket option to the specified value, represented as an object.
Public method Shutdown Disables sends and receives on a Socket.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft