Networking

Function CheckSockets(timeout_ms)

Checks all connected sockets for activity. If timeout_ms is greater than 0 than it will wait that many milliseconds. If less than 0 it will wait for over 49 days (hint: there is no reason what so ever to set this less than 0).

Returns the number of sockets that have activity (ie. a connection was made or data was sent).


Function TCP_SocketReady(socket)

Returns 0 for no activity and non zero for activity. You need to call CheckSockets() at some point before this otherwise it will always return 0.


Function UDP_SocketReady(socket)

Returns 0 for no activity and non zero for activity. You need to call CheckSockets() at some point before this otherwise it will always return 0.

If UDP_SocketReady ( 0 ) > 0 Then 
'Socket has activity so we can do something here
End If

See also

CheckSockets()


Function TCP_OpenSocket(host$, port)

Opens a socket to talk to host$ on the given port.


Sub TCP_CloseSocket(socket)

Closes a socket.


Function TCP_RemoteHost(socket)

Returns the destination host address.


Function TCP_RemotePort(socket)

Returns the port the socket is connecting on.


Function TCP_GetData(socket, numBytes, ByRef sData$)

Reads a given number of bytes from a socket.


Sub TCP_SendData(socket, sData$)

Send data through the given socket.


Function TCP_AcceptSocket(server)

Attempts to accept a connection from a server socket. If successful it will return a client socket id. If it fails it will return -1.


Function UDP_OpenSocket(port)

Opens a UDP socket.


Sub UDP_CloseSocket(socket)

Closes a UDP Socket.


Function UDP_GetData(socket, byref host$, byref port, byref sData$)

Reads data from a udp socket.


Function UDP_Length()

Returns the number of bytes read from a udp socket.


Function UDP_MaxLength()

Returns the maximum number of bytes from a udp socket.


Function UDP_RemoteHost$(socket)

Returns the connected host in a udp connection.


Function UDP_RemotePort(socket)

Returns the port the socket is connected on.


Sub UDP_SendData(socket, host$, port, sData$)

Sends data to a host using UDP.