![]() |
|
| << Previous | Index | Next >> | |
| | |
int tcp_open( tcp_Socket *s, word lport, longword remip,
word port, dataHandler_t datahandler );Description
This function actively creates a session with another machine. After a call to
tcp_open(), the functionsock_established()(or the macrosock_wait_established) must be called to poll the connection until a session is fully established.It is possible for a connection to be opened, written to and closed between two calls to the function
sock_established(). To handle this case, callsock_bytesready()to determine if there is data to be read from the buffer.Parameters
s
- Pointer to a socket structure.
lport
- Our local port. Use zero for the next available port in the range 1025- 65536. A few applications will require you to use a particular local port number, but most network applications let you use almost any port with a certain set of restrictions. For example, FINGER or TELNET clients can use any local port value, so pass the value of zero for
lportand letDCRTCP.LIBpick one for you.
remip
- IP address to connect to.
port
- Port to connect to.
datahandler
- Function to call when data is received;
NULLfor placing data in the socket's receive buffer. Prior to Dynamic C 7.30, some details for implementation of this service had not been finalized. Insert a value ofNULLif you are using a version of Dynamic C prior to 7.30.
Return value
0: Unable to resolve the remote computer's hardware address.!0otherwise.Library
TCP.LIB (Prior to DC 7.05, this was DCRTCP.LIB)
See also
Example Using tcp_open()
| TCP/IP Manual Vol 1 |
<<Previous | Index | Next>> | rabbit.com |