Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
The parameters to set are the same for “GENERIC_TCP_CLIENT” and for “GENERIC_TCP_SERVER”.
Them are:
Count: the number of Socket for connection to use; them can be different from client and
server
TX Buffer: the maximum dimension of transmission buffer
RX Buffer: the maximum dimension of receive buffer
The total TCP socket memory is the maximum space that can be used for TCP sockets inside the Wi-Fi
module's memory. The TCP buffers are not stored in microcontroller's memory but in the Wi-Fi
module's memory, so using TCP sockets does not affect PIC memory usage. A maximum of 8100
bytes can be used. This is the sum of all TCP sockets that are listed in the “Currently Defined Sockets”
list.
The “GENERIC_TCP_XXXXXX” TX and RX Buffer dimension are the MAXIMUM dimension of data that
can be transmitted or received in a single packet. If the user application needs to send 500- byte
packets in a TCP server connection, the relevant TX Buffer must necessarily be bigger, the same for
RX Buffer.
The TCP_SOCKET status is invalid when the TCP connection is not working. Checking the status of a
TCP socket is a way to know if the connection is working and opened without problems.
There are two connection types, one where Flyport is the Server, the other where Flyport is the
Client.
If Flyport is the Server the parameter needed is only the port number;
if Flyport is the Client the parameters needed are port number and IP address of Server.
To open a TCP connecLonmyTCPSocket=TCPServerOpen(char[] tcpport);
or
myTCPSocket=TCPClientOpen( char[] tcpaddr,
char[] tcpport);
To close a TCP connecLon → TCPServerClose(myTCPSocket);
or
TCPClientClose(myTCPSocket);
It can be useful to detach a client while Flyport has a server role. This is not a full connection close,
since it still allows for other clients to communicate with the server.
To detach a client TCPServerDetach(myTCPSocket);
This disconnects a Client from connection, and the port reverts to a listening status. Another client
could connect using the Server using the same TCPSocket after detaching the first client.
To check a TCP connecLon → TCPisConn(myTCPSocket);
Returns:
connection state: true TCP is connected
false TCP is NOT connected
This function is useful to check if a TCP connection is available
40