Std socket socket
std:std.socket.Socket
Class Socket Extends Resource#
The Socket class.
The socket class provides a thin wrapper around native Winsock and BSD sockets.
Sockets support asynchronous programming through the use of fibers. To connect, send or receive asynchronously, simply run the relevant socket code on its own fiber. Control will be returned to the 'main' gui fiber will the operation is busy.
Sockets are ipv4/ipv6 compatible.
Properties | |
---|---|
Address | The address of the socket. (read only) |
CanReceive | The number of bytes that can be received from the socket without blocking. (read only) |
Closed | True if socket has been closed. (read only) |
Connected | True if socket is connected to peer. (read only) |
PeerAddress | The address of the socket peer. (read only) |
Methods | |
---|---|
Accept | Accepts a new incoming connection on a listening socket. |
Close | Closes a socket. |
GetOption | Gets a socket option. |
Receive | Receives data on a connected socket. |
ReceiveFrom | |
Send | Sends data on a connected socket. |
SendTo | |
SetOption | Sets a socket option. |
Functions | |
---|---|
Bind | Creates a datagram server socket. |
Connect | Creates a connected socket. |
Listen | Creates a stream server socket and listens on it. |
Protected methods | |
---|---|
OnDiscard | |
OnFinalize |