Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
TCP Usage
Basic usage example of a TCP Client and Server connection
This short example shows how a user should configure the taskFlyport.c file to use a TCP connection
in both Server and Client mode using two different sockets.
#include "taskFlyport.h"
void FlyportTask()
{
TCP_SOCKET SocketTCPServer = INVALID_SOCKET;
TCP_SOCKET SocketTCPClient = INVALID_SOCKET;
BOOL clconn = FALSE;
BOOL clconnClient = FALSE;
// Flyport Wi-Fi // Flyport Ethernet
WFConnect(WF_DEFAULT); while(!MAClinked);
while (WFStatus != CONNECTED);
UARTWrite(1,"Flyport connected... hello world!\r\n");
const char txstring[6] = "hello!";
const int txstringlen = 6;
int tcprxlength = 0;
IOPut(d5out, off);
while(1)
{
// Check TCP Server Connection Activity
if(TCPisConn(SocketTCPServer))
{
if (clconn == FALSE)
{
clconn = TRUE;
IOPut(D4Out,on);
}
}
else
{
if (clconn == TRUE)
{
clconn = FALSE;
IOPut(D4Out,off);
}
}
// Check TCP Client Connection Activity
if(TCPisConn(SocketTCPClient))
42