Seite 32 von 72
8.6 Sample C++ Code for setting up a socket
//Including the winsocket library for creating sockets later in the code
#include
<winsock.h>
#pragma
comment
(
lib
,
"ws2_32.lib"
)
void
main(
void
)
{
//Start the winsocket
WSADATA
wsadata;
WSAStartup(MAKEWORD(2,2),&wsadata);
//Set up the socket
SOCKET
s;
s = socket(AF_INET, SOCK_STREAM, 0);
SOCKADDR_IN
target;
//Inside target will the socket address information be saved
target.sin_family
=
AF_INET;
//address family is Internet, over which we will
communicate
target.sin_port = htons(50010);
//IT is the Portnumber from the C3 Sample for the
PCIC
target.sin_addr.s_addr
=
inet_addr(
"192.168.0.69"
);
//Ip address of the C3 Sample
//Definde the socket and connect it to the C3Sample
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
connect(s,
(SOCKADDR
*)&target,
sizeof
(target));
//Disconnect the socket
closesocket(s);
WSACleanup();
}
Summary of Contents for O3D303
Page 1: ...Seite 1 von 72 Operations Manual 3D camera O3D303 ...
Page 10: ...Seite 10 von 72 6 1 Wiring ...
Page 13: ...Seite 13 von 72 ...