Example (EDG-4508+U):

SOCKADDR_IN Dst4508UAddr; SOCKET Dst4508USock;

char RxData[10];

memset(&Dst4508UAddr, 0, sizeof(SOCKADDR_IN)); Dst4508UAddr..sin_family = AF_INET; Dst4508UAddr..sin_addr.s_addr = inet_addr("10.0.0.1"); //Indicate the IP Address of EDG-4508+U that you want to connect.// Dst4508UAddr..sin_port = htons(5201);

//Indicate which port of EDG-4508+U you want to access//

//TCP port no. of Port1 = TCP port +1//

//TCP port no. of Port2 = TCP port +2//

Dst4508USock = socket(AF_INET, SOCK_STREAM, 0));

//EDG-4508+U creates the TCP socket// connect(Dst4508USock, (sockaddr *)&Dst4508UAddr, sizeof(Dst4508UAddr));

//Connect to the EDG-4508+U// send(Dst4508USock, "0123456789", 10, 0);

//Send data "0123456789" to the port of EDG-4508+U// recv(Dst4508USock, RxData, 10, 0);

//Receive the data from the port of EDG-4508+U// closesocket(Dst4508USock);

//Disconnect from the EDG-4508+U//

EDG-4508+/4516+ User Manual

68

Page 80
Image 80
Vicks EDG-4516+ user manual Example EDG-4508+U