Hi there,
I have Gateway software running on my Fastrack Xtend. It is nicely bridging ethernet devices and GPRS. Now I have a requirement to write another thread that periodically sends a message out to a server. With Gateway application doing WIP_NET_OPT_IP_FORWARD=TRUE, my app thread is not able to connect outside. Here is my app thread code:
socket = wip_TCPClientCreate( MY_SERVER_ADDR,
MY_SERVER_PORT,
sendServerUpdate,
(void*) 0 );
static void sendServerUpdate( wip_event_t *ev, void *ctx) {
switch( ev->kind) {
case WIP_CEV_OPEN: {
wip_debug ( "WIP_CEV_OPEN - Connection established successfully.\n");
break;
}
case WIP_CEV_READ: {
int nread;
wip_debug ( "WIP_CEV_READ - Some data arrived\n");
nread = wip_read( .....);
break;
}
/* Just after the connection was open,
* and when it is able again to send more data after it has been saturated
* with data to send, it receives an event [WIP_CEV_WRITE]. */
case WIP_CEV_WRITE: {
int snd_offset = 0; //(int) ctx;
int nwrite;
wip_debug("WIP_CEV_WRITE - Can send more data. offset=%d\n", snd_offset);
...
wip_write(........);
....
break;
}
case WIP_CEV_ERROR: {
wip_debug( "WIP_CEV_ERROR - Error %i on socket. Closing.\n",
ev->content.error.errnum);
wip_setCtx( ev->channel, (void*) 0);
wip_close( ev->channel);
break;
}
case WIP_CEV_PEER_CLOSE: {
wip_setCtx( ev->channel, (void*) 0);
wip_close( ev->channel);
socket = NULL;
break;
}
default: {
wip_debug( "default case %d\n", ev->kind);
}
}
I tried using TCPClientCreateOpts too with ‘WIP_COPT_ADDR’ option without any success. Can someone tell me how I can write an AT app to coexist with GatewaySample?
Thanks,
Haiden