I need a application that acts as a tcp server. When a client connects I want it to make a transparent connection so that what comes in from the client is put on the serial port and the otherway arround.
I have managed to make the tcp server and the client can connect, but how to make the transparent part.

Best regards


Why don’t you simply send everything you receive from TCP to UART and vice versa? You can write and read some specific UART with FCM facility.

Tryed to but cant get it to work.
I have created a tcp server with WIP.
When i get WIP_CEV_OPEN i try to subscribe by

V24Handle = adl_fcmSubscribe (ADL_FCM_FLOW_V24_MASTER | ADL_FCM_FLOW_GPRS_PREFERRED, V24CtrlHandler, V24DataHandler );

but nothing happends.

Did you check the return value from adl_fcmSubscribe :question:

Yes - V24Handle was 0

and what did you do next with that handle?

I expected to receive a ADL_FCM_EVENT_FLOW_OPENNED in the V24ControlHandler but i diddent.
After I have received the ADL_FCM_EVENT_FLOW_OPENNED I would have called
sReturn = adl_fcmSwitchV24State ( V24Handle, ADL_FCM_V24_STATE_DATA );
to switch to data state.

Yes, that would be the expected behaviour.

Which specific flow are you intending to subscribe here?

I want to make at transparent data flow between the rs232 port and a GPRS connection. From the GRPS socket connection the modem receives a request for data and the PLC on the rs232 port then replies.
I found ADL_FCM_FLOW_V24_MASTER | ADL_FCM_FLOW_GPRS_PREFERRED in an example. Not sure it’s correct.

What example?

I can’t see ADL_FCM_FLOW_GPRS_PREFERRED in the ADL User Guide (not for v6.11, anyhow)

Has anyone managed to accomplish this?
Tcp Server tunnels its incoming data to the serial port, and vice versa?

Any advice would be appreciated


This is a problem of 2 halves:

1. Serial Port IO
It doesnt matter to the serial port IO where the data comes from, or where it goes to - so just treat this as any other serial port IO problem

2. TCP Comms
Again, It doesnt matter to the TCP Comms where the data comes from, or where it goes to - so just treat this as any other serial TCP Comms problem

You will, of course, have to devise or find some suitable protocol for transporting the data over TCP.

And some buffering scheme between the UART and TCP.

MANY of us, i suppose! Ask more specific questions and if we can help…

Thank you very much

I have installed the M2M studio application and started playing with the TCP server sockets, and they seem to work fine over GPRS.

Have not touched the serial part yet.

First things first, im getting the tcp server part ready before im going to touch the serial side of things.

However i have run into a few issues…

To begin with, im creating a connection handler which can handle 1 or more connections, all new
connections are stored in

static wip_channel_t *ActiveChannels[8];

the new connections are added by:

static void evh( wip_event_t *ev, void *ctx) {
  static int clients_count = 0;

  switch( ev->kind)

	  case WIP_CEV_OPEN:
		wip_debug ( "[SAMPLE] New client connection 0x%x. "
					"There are now %i clients connected.\n",
					ev->channel, clients_count);

					int OpenChannel = GetChannelSlot();

						ActiveChannels[OpenChannel] = ev->channel;


And then i try to see if a connection is dead by using a timer and

for(i = 0; i < 8; i++)
		if(ActiveChannels[i] != NULL)
			wip_debug ("channel=%d state=%d\r\n",i, wip_getState(ActiveChannels[i]));



The state doesnt change when i drop the tcp IP connection, so is there any other way to determine if a client has dropped a connection to the tcp server?

I basically want to make sure the clients are all still connected, when i get to the serial part i want to broadcast all serial data to active clients in my ActiveChannels[] list

Dead clients are to be removed from the list, once i find a way to spot them.


Ok, just found a solution to my previous post! :slight_smile:

All data needs to be read before the connection reset event fires on a channel.

Now i guess its a question of polling the serial port and seeing if theres something, then reading and sending it to the active clients on the server…

Any ideas or advice?
I have tried to look for documentation on the WIP API (not AT commands), i someone knows of anything that will help me, it will be greatly appreciated.


So why start a new thread?

Why no link to the old post - how is anyone who didn’t notice it supposed to know what you’re talking about?

Use FCM - received data is then just passed to you as it arrives.

The document you require is:

Open AT IP Connectivity Development Guide (WIPlib v5.10)

Sorry for so many posts - trying to work around forum bug: