Multitech MultiModem Cell MTCBA-C1 User's Guide Page 122

  • Download
  • Add to my manuals
  • Print
  • Page
    / 135
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 121
Chapter 20 – Host Application Scenarios
Multi-Tech Systems, Inc. CDMA C1 AT Commands Reference Guide (PN S000478C) 122
TCP Server Example
The device can also act as a server and wait for incoming connections. In this example, a listening socket is
opened. When a connection is established from a client, the module receives an unsolicited response. When the
client sends data, another unsolicited response is received. The application switches the module to on-line data
mode to read the received data. The client closes the connection and the module receives another unsolicited
response.
at+wipbr=4,6 // open PPP bearer
OK
+WORG: #777
+WCNT: 33
+WIPBR: 6,1
+WEND: 25
AT+wipbr=3,6,15 // find our IP address
+WIPBR: 6,15,"75.251.5.204"
OK
at+wipcreate=3,1,80,5,8 // create TCP listen socket on port 80 as connection 1
OK
+WANS: 2
+WCNT: 33
+WIPACCEPT: 1,5 // incoming connection request. Connection 5 active.
+WEND: 29
+WANS: 2
+WCNT: 33
+WIPDATA: 2,5,8 // 8 bytes available on TCP connection 5.
+WEND: 29
at+wipdata=2,5,2 // enter on-line data mode on connection 5
CONNECT
hi there // received data
NO CARRIER
+WANS: 2
+WCNT: 33
+WEND: 29
+WIPPEERCLOSE: 2,5 // peer closed connection 5
+WANS: 2
+WCNT: 33
+WEND: 29
at+wipclose=3,1 // close listening socket
OK
at+wipbr=5,6 // close PPP bearer
OK
+WORG: #777
+WCNT: 33
+WIPBR: 6,0
+WEND: 29
Page view 121
1 2 ... 117 118 119 120 121 122 123 124 125 126 127 ... 134 135

Comments to this Manuals

No comments