GLBasic User Manual

Main sections

SOCK_TCPACCEPT

sock% = SOCK_TCPACCEPT(sock_listen%, BYREF ip$)


This function returns a valid socket (<> -1) if another process has successfully used SOCK_TCPCONNECT() to connect to your SOCK_TCPLISTEN() port.
You can now communicate with other processes by reading from or writing to this socket.
When you don't need this connection anymore, call SOCK_CLOSE() to close this socket.

The string ip$ will get the binary IP address of the remote computer. You can use it in SOCK_UDPSEND to send a UDP message to this computer.
With SOCK_GETIP$() you can translate this IP into a readable form.

You can retrieve any error messages with NETGETLASTERROR$().

See also...