Attempts to connect to a server specified by the host and port number. The 'host' can either be an IP address (ie. "127.0.0.1") or a hostname ("www.example.com"). 'port' must be between 1 and 65535, but you should avoid commonly used ports (ie. 21, 80, etc.) unless you know what you're doing.
If the connection succeeds, this function returns
Note: TCP only!
Attempts to set this socket into "listen" mode. That is, it will act like a server and wait for new connections. The 'host' should probably be an empty string (ie. "") in order to accept connections from any incoming network, but you may also specify which network you would like (ie. "127.0.0.1" to only accept connections from localhost, "192.168.1.x" for LAN-only connections, etc.).
If this function succeeds, it will return
Attempts to send information across an already-connected socket. If the message was successfully
sent, this function returns
NOTE: TCP only!
Attempts to send information across a UDP-connected socket. If the message was successfully sent,
this function returns
You may either specify an IP/port to send the message to, or (when responding to received messages)
NOTE: UDP only!
If there are any messages in the input queue, returns the message on the top of the stack and pops it.
It is probably a better idea to rely on capturing the socketreceived event rather than using using recv() in your main-loop. Use this function only if you know what you're doing.
Returns the number of messages still in the receive queue.
Flushes (discards) all messages in the queue on this socket.
Closes a socket and shuts down related network threads. This will happen automatically as a
socket object goes out of scope or is set to
Returns the socket's ID. You may use this to uniquely identify the socket, however you should be aware that socket IDs may be recycled.
Returns the socket's IP. Generally only useful server-side to find out which IP you're listening on (clients will generally be 0.0.0.0 or "any").
Returns the socket's port. On the server, this will be the port you are 'listening' on, and on the client this will be assigned automatically.
Page last updated at 2018-09-25 20:48:33