Multitech MultiConnect Adapter Guía de usuario Pagina 146

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 154
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 145
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) 146
Scenario 1 – Setting up UDP Sessions and IP
Module Acting as Client
Create a UDP socket on the IP Module and connect to a UDP socket on a remote host. Once created, the socket can
be used to send data to and receive data from only this particular remote host.
Command
socket udp <remote_ip> <remote_port> [local_port]
<remote_ip> and <remote_port are ip address of the machine running a UDP socket and port number to which
the socket is bound to respectively.
Example
To connect to the UDP socket on host A from IP Module i.
Create UDP socket (local port is optional)
#socket udp 192.168.1.120 2000
<4>
OK
#
You can use the returned socket handle top send and receive data
#socket send -d $ 4
Enter data- ('$' to terminate)
--- 5 bytes sent ---
OK
#socket recv 4
hello
---5 bytes received---
OK
#
Multiple UDP Sessions
Since a UDP socket can be used to connect to only a single remote host, for every new connection a new socket has
to be created using the command socket udp <remote_ip> <remote_port>.
Vista de pagina 145

Comentarios a estos manuales

Sin comentarios