I am using Dev studio open at application. I am beginner to this tool. In this i tried the sample code given for TCP client. By using this code i can able to communicate with my server in the opened socket. Also i tried to send packets at periodic intervals by using timer function. For this i developed code below
but that function is only send up to 15 packets with creating 15 different port no of client with same ip after that no more packet reached to server.
In trace window we got “[SAMPLE] Can’t connect”
can anyone tell me why the socket can’t create.
Another question:
Which i have used to send packets at periodic interval to server is correct way ?
If is there some other way means kindly help me.
In your code you are creating a new TCP client every 15 seconds. The internet plugin can only support 15 concurrent TCP clients, which is why you are failing to connect. You have two options to resolve this:
Open the TCP client, send the data, close the TCP client, repeat every 15 seconds, or
Open the TCP client, send data every 15 seconds, close the client.
I’d recommend option 2. So, when you start your application and have a GSM network connection and have started your GPRS bearer, create the TCP client and store the handle. Then, in your 15 seconds timer, call wip_write with the TCP client handle and the data you want to send. See the picture below from the WIP Development Guide.
I think you are not understanding the way OpenAt works at all, and should probably start with a simpler example.
Firstly, you have tried to use a wip callback function as your timer callback function. These should be completely separate. Do it like this:
[attachment=0]TCP Client.png[/attachment]
When you create the TCP Client, you provide it with an event handler.
for this time also received error ad “[SAMPLE] write Error -999”
can anyone explain me why this error occurs?
From the error value i guess socket is not opened is it wright?
i have doubt in passing arguments to function packetsend?
is there anyother way available to send packets at periodic intervals?
if avail means send me that.
Unless you fix these errors, you will not get anywhere.
I think you should go back to the hello world sample application and make sure you understand that fully before moving on to something as complex as a TCP client application.
Hi,
i have tried the code which you given in the last reply,
but for that i got the following errors .\src\entry_point.c:255: error: invalid storage class for function ‘timerCallback’
…\src\entry_point.c:265: error: expected declaration or statement at end of input
If the server closes the connection and you get WIP_CEV_PEER_CLOSE, or if some other error occurs, shutdown the client connection using
wip_closeAndClear(&ev->channel);
and reopen it using
wip_TCPClientCreate
If there is some other GPRS or GSM related error, you may also have to close down your GPRS connection and restart that too. Alternatively, the other solution is to just reset your entire modem and start from scratch.
the above code i used to send packets at periodic intervals.
In this code WIP_CEV_OPEN only processed with timer then how do i handle following error responses
WIP_CEV_ERROR
WIP_CEV_PEER_CLOSE
whether can check those state in the switch case inside the cbevh function?
Yes, look at the sample application. The code provided was an example showing the relevant section, not a complete solution. You should handle all possible cases of the switch variable.