# openSocket

An OS specific routine to establish a TCP/IP connection to a partner. There are different implementations for LINUX and WIN32. While the OS specific implementation of openSocket() is part of LIBNODAVE dynamic library, you could use your own routine and copy the resulting file descriptor/handle to the members of your _daveOSserialType structure.

        int openSocket(const int port, const char * peer);

- port is the port number for the protocol, usually 102 for ISO over TCP or 1099 for the IBH/MHJ NetLink protocol.
- peer is the IP address of the PLC/CP as a string, e.g. 192.168.0.3 .

### Note:

With regard to Libnodave, you are free to use other port numbers. While you cannot change port numbers on S7 devices or IBH NetLinks, this can be useful with port redirecting software like
rinetd, which makes a gateway listen on several ports and then redirects connections to other IP adresses.
This is the reason, why default port numbers are not hard coded in Libnodave.