Advantech ADAM-4572 Manuale Utente Pagina 53

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 67
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 52
44 ADAM-4579 Users Manual
Example:
SOCKADDR_IN Dst4579Addr;
SOCKET Dst4579Sock;
char RxData[10];
memset(&Dst4579Addr, 0, sizeof(SOCKADDR_IN));
Dst4579Addr..sin_family = AF_INET;
Dst4579Addr..sin_addr.s_addr = inet_addr("10.0.0.1");
//Indicate the IP Address of ADAM-4579 that you want to connect.//
Dst4579Addr..sin_port = htons(5201);
// Indicate which port of ADAM-4579 you want to access//
// TCP port no. of Port1 = TCP port +1//
// TCP port no. of Port2 = TCP port +2//
Dst4579Sock = socket(AF_INET, SOCK_STREAM, 0));
// ADAM-4579 creates the TCP socket//
connect(Dst4579Sock, (sockaddr *)&Dst4579Addr,
sizeof(Dst4579Addr));
//Connect to the ADAM-4579//
send(Dst4579Sock, "0123456789", 10, 0);
//Send data "0123456789" to the port of ADAM-4579//
recv(Dst4579Sock, RxData, 10, 0);
//Receive the data from the port of ADAM-4579//
closesocket(Dst4579Sock);
//Disconnect from the ADAM-4579//
Vedere la pagina 52
1 2 ... 48 49 50 51 52 53 54 55 56 57 58 ... 66 67

Commenti su questo manuale

Nessun commento