I've got a strange thing happening with some networking code. I'm compiling in Visual Studio 2005 and using the Psion Mobile Device SDK 5.4. The device I'm running on is, as noted in the title, an Omnii XT15. The OS on it is Embedded 6.5, and I'm compiling my software for Mobile 6.
I have some code which opens a docket to a remote web server, sends some HTTP headers and reads back the response. I was previously using the Windows API for this (InternetOpenURL and so on) but encountered the same issue, so I switched to using the more generic socket functions in the hope it would alleviate it. No such dice, unfortunately.
What's happening is when I first call the socket function to create (not even connect) the socket, sometimes the function does not complete for a number of minutes. It doesn't do it every time I call it, just occasionally, and usually it's the first time I call it. The code where the problem is occurring is:
s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(s==INVALID_SOCKET) { strcpy(error,"Failed to create socket"); break; }
The only network-related code I'm calling prior to that is the WSAStartup function (WSAStartup (0x0202, &wsaData) to be precise).
I can run the same software on an older Ikon with Windows Mobile 6.1 Professional and it does not have this problem. This makes me think it's an issue with the libraries I'm using. Should I be using a different version of the SDK? Has anyone else struck this problem?
Thanks for any and all help!