User guide

Chapter 17 – TCP APP AT Commands
Multi-Tech Systems, Inc. CDMA C1 AT Commands Reference Guide (PN S000478C) 101
Service Creation +WIPCREATE
Description: The +WIPCREATE command is used to create UDP, TCP client, and TCP server sockets
associated with the specified index and service.
If a local port is specified while creating a socket, the created socket will be assigned to this port;
if not, a port will be assigned dynamically. If peer IP and peer port are specified, the created
socket will be connected to the specified IP and port.
TCP server cannot be used to transfer data. To transfer data, it creates a local TCP client socket.
This process of creating local socket is referred to as “spawning”. When a server socket is
created, the socket passively listens on a specified port for incoming connections. On reception of
a connection request from a remote client socket, a server socket does the following:
Spawns a new socket (client) to connect to the remote socket
Data transfer is done between the spawned socket and the remote socket
Server socket remains in the listening mode and is ready to accept the request from other
clients
A UDP socket can be created which acts as a “listening” socket waiting for first incoming
datagram to the specified local port. This is accomplished by creating a socket with protocol set to
1 (UDP) and specifying only a Local Port, without providing a Peer IP Address or Peer Port. The
+WIPDATA unsolicited response is output when a datagram is received on the port.
Note: The UDP “Listen” socket can receive incoming datagrams; however, it does not bind to the
peer IP Address/port, and thus cannot be used to transmit data. To reply to the received
datagram, a new UDP socket must be created using the datagrams source IP Address and port.
Syntax: Command syntax: If <protocol> = 1: AT+WIPCREATE=<protocol>,<index>,[<local port>]
[,<peer IP>,<peer port>]
If <protocol> = 2: AT+WIPCREATE=<protocol>,<index>,<peer IP>,<peer
port>
If <protocol> = 3: AT+WIPCREATE=<protocol>,<server index>,<local
port>,<from idx>,<to idx>
Command Possible Responses
AT+WIPCREATE=1,<index>,[<local port>]
[,<peer IP>,<peer port>]
OK
+WIPREADY: 1,<index>
AT+WIPCREATE=2,<index>,<peer IP>,
<peer port>
OK
+WIPREADY: 2,<index>
AT+WIPCREATE=3,<server index>,
<local port>,<from idx>,<to idx>
OK
AT+WIPCREATE? Lists all open sockets.
+WIPCREATE: <protocol>,<index>,<local port>,
<peer IP>,<peer port>
OK
Values: <protocol>
1 UDP
2 TCP client
3 TCP server
<index>
1-8 Socket or session identifier
<local port>
0 – 65535 Local TCP/UDP port
<peer IP> Peer IP address; a string between quotes indicating an address either in numeric
form (e.g., “85.12.133.10”) or as a DNS entry (e.g., www.wavecom.com)
<peer port>
0 – 65535 Peer TCP/UDP port
<server index>
1-4 TCP server socket index
<from idx>
1-8 Minimum index for spawned TCP client sockets
<to idx>
1-8: Maximum index for spawned TCP client sockets