Proxim 7910 Guida Utente Pagina 97

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 127
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 96
91
Sample TCP/IP Communication Programs
On the following pages are four pieces of sample code written in
Berkeley Sockets as an example of the type of custom code which
must be written so that the Serial Adapter can communicate with
nodes on an Ethernet network.
Note:
If your custom program makes use of the “$QUIT”
command so that the Serial Adapter will close open TCP
connections, set the TCP Close Connection Signal pa-
rameter to “Yes” within the Serial Adapter’s Advanced
Configuration Menu.
Sample TCP Receive Program
1 /*******************************************************
2 * tcprecv.c
3 * Receives messages from one or more Serial Adapters using TCP
4 *
5 *******************************************************/
6
7 #include <sys/types.h>
8 #include <sys/socket.h>
9 #include <netinet/in.h>
10 #include <netdb.h>
11 #include <stdio.h>
12
13 #define TRUE 1
14
15 main()
16 {
17 int i, sock, length;
18 struct sockaddr_in server;
19 int msgsock;
20 char buf[1024];
21 int rval;
22 FILE *logfile;
Vedere la pagina 96
1 2 ... 92 93 94 95 96 97 98 99 100 101 102 ... 126 127

Commenti su questo manuale

Nessun commento