Multitech MultiConnect Adapter Guía de usuario Pagina 147

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 154
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 146
Chapter 15 – Raw TCP/UDP Socket Interface to the Serial Device
Command Line Interface and Application Examples for Multi-Tech Systems, Inc. IP Modules (S000368F) 147
Scenario 2 – Setting up UDP Sessions and IP
Module Acting as Server
Start a Listen Socket in the IP Module and wait for incoming requests to connect. In this case, the socket will latch on
to the first client from which the data is read from and can further be used to send data to and receive data from only
that client.
Command
socket udp 0.0.0.0 0 <local_port>
The <remote_ip> and <remote_port> parameters are specified as 0.0.0.0 and 0 respectively for the udp listen
socket. The <local_port> parameter is mandatory for listen socket.
Example
Start a UDP listen socket on ip-module i.
#socket udp 0.0.0.0 0 3000
<4>
OK
#socket listall
No TCP connect sockets
No TCP listen sockets
UDP sockets
SockHandle SockType RemoteIP RemotePort LocalIP LocalPort
4 UDP listen 0.0.0.0 0 192.168.1.144 3000
OK
#
Now, when i receives data from A, the UDP socket <4> latches itself to A.
#socket recv 4
data
--- 4 bytes read ---
OK
#socket listall
No TCP connect sockets
No TCP listen sockets
UDP sockets
SockHandle SockType RemoteIP RemotePort LocalIP LocalPort
4 UDP socket 192.168.1.120 2000 192.168.1.144 3000
OK
#
Any further send on socket <4> will result in sending data to A.
If B sends data to i on port 3000, socket <4> will not accept it, since it is latched to A and is listening only to
A. Thus, in order to receive data from or send data to B, you'll have to create another UDP listen socket on a
different port number.
Vista de pagina 146

Comentarios a estos manuales

Sin comentarios