<< Previous | Index | Next >>

sock_established


int sock_established( void *s );

Description

TCP connections require a handshaked open to ensure that both sides recognize a connection. Whether the connection was initiated with tcp_open() or tcp_listen(), sock_established() will continue to return 0 until the connection is established, at which time it will return 1. It is not enough to spin on this after a listen because it is possible for the socket to be opened, written to and closed between two checks. sock_bytesready() can be called with sock_established() to handle this case.

UDP is a connectionless protocol, hence sock_established() always returns 1 for UDP sockets.

Parameters

s

Pointer to a socket.

Return value

0: Not established.
1: Established.

Library

TCP.LIB (Prior to DC 7.05, this was DCRTCP.LIB)

See also

sock_bytesready, sockstate


TCP/IP Manual
Vol 1
<<Previous | Index | Next>> rabbit.com