Re: using Socket calls in OSdesign subproject

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Paul,

I need one more clarification regarding the current problem i'm facing.
Request you to please advice.
The ARM BSP i'm using supports NDIS 5.1 miniport driver. Is this enough to
get the TCP network functions working in WinCE 6.0?
There is one more option in the WinCE catalog view that, device
drivers->Networking->Local Area networking devices and here we have driver
selection option for NIC's.
Now my question is that, Should NDIS 5.1 miniport driver is enough or i need
to choose one of the NIC driver also? Please suggest.

regards


"Paul G. Tobey [eMVP]" wrote:

In fact, your code runs fine on my device...

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:eGwIHD9qJHA.5356@xxxxxxxxxxxxxxxxxxxxxxx
"doesn't work" is useless information. The code, at first inspection,
looks fine to me. If something is failing, get the error code and tell us
what call is failing and what WSAGetLastError() returns after the failure.

Paul T.

"vinay" <vinay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:034BFFF0-0A61-49D6-9718-46819352E07D@xxxxxxxxxxxxxxxx
Hi All,

The following is the Winsock server code that i am using. This works fine
in
windows and tested with a winsock client. The same code does't work in
WinCE.
It comes to the level of accpeting socket and blocks there. The client
trying
to connect to this server times out and is unable to connect. Please
help.
_______________________________________________________
The TCP server code
---------------------
RETAILMSG(1, (L"CMainWindow::Socket: Staring TCP server code
here..\r\n"));
SOCKET server;
WSADATA wsaData;
sockaddr_in local;
WORD version = MAKEWORD( 2, 2);
int wsaret=WSAStartup(version,&wsaData);
//WSAStartup returns zero on success.
//If it fails we exit.
if(wsaret!=0)
{
RETAILMSG(1, (L"CMainWindow::Socket: SWSAStartup FAILS..\r\n"));
return FALSE;
}
//Now we populate the sockaddr_in structure
local.sin_family=AF_INET; //Address family
local.sin_addr.s_addr=INADDR_ANY; //Wild card IP address
local.sin_port=htons((u_short)1234); //port to use

//the socket function creates our SOCKET
server=socket(AF_INET,SOCK_STREAM,0);
//If the socket() function fails we exit
if(server==INVALID_SOCKET)
{
RETAILMSG(1, (L"CMainWindow::Socket: Socket creation FAILS..\r\n"));
return FALSE;
}
else
RETAILMSG(1, (L"CMainWindow::Socket: Socket creation success..\r\n"));

if(bind(server,(sockaddr*)&local,sizeof(local))!=0)
{
RETAILMSG(1, (L"CMainWindow::Socket: Socket bind FAILS..\r\n"));
return FALSE;
}
else
RETAILMSG(1, (L"CMainWindow::Socket: Socket bind success..\r\n"));

if(listen(server,10)!=0)
{
RETAILMSG(1, (L"CMainWindow::Socket: Socket listen FAILS..\r\n"));
return FALSE;
}
//we will need variables to hold the client socket.
//thus we declare them here.
SOCKET client;
sockaddr_in from;
int fromlen=sizeof(from);

while(true)//we are looping endlessly
{
//accept() will accept an incoming client connection
char temp[512];
RETAILMSG(1, (L"CMainWindow::Socket: Socket Accept loop..\r\n"));
client=accept(server,(struct sockaddr*)&from,&fromlen);
if(client == INVALID_SOCKET )
{
RETAILMSG(1, (L"CMainWindow::Socket: Socket Accept FAILS..\r\n"));
//close the client socket
closesocket(client);
}
else
{
RETAILMSG(1, (L"CMainWindow::Socket: Socket Accept success..\r\n"));
sprintf(temp,"Your IP is %s\r\n",inet_ntoa(from.sin_addr));
//we simply send this string to the client
RETAILMSG(1, (L"CMainWindow::Socket: Send IP address to client
here..\r\n"));
send(client,temp,strlen(temp),0);
break;
}
}

closesocket(server);
WSACleanup();

---------------------------------------------------------------------------------------
end of server code

regards

"Luca Calligaris" wrote:

does yor OS design include winsock support (catalog item under
Communication
services and networking\networking-general)?are you linking your project
to
ws2.lib?

--

Luca Calligaris (MVP-Windows Embedded)
http://geekswithblogs.net/WindowsEmbeddedAnnotations
l.calligaris.nospam@xxxxxxxxxxxxxxxxxx
www.eurotech.it

"vinay" <vinay@xxxxxxxxxxxxxxxxxxxxxxxxx> ha scritto nel messaggio
news:A1DAC36A-E931-4174-8DEC-989AC92E724E@xxxxxxxxxxxxxxxx
Hi,

I am Creating WinCE 6.0 R2. OSdesign using ARMV4I BSP for a ARM
target. I
am
using VS2005 with Platform builder plugin. I have created an OSdesign
subproject in this solution framework and would like to use the SOCKET
functions in the subproject. I tried with both winsock and winsock2
but
the
linker is throwing error no LNK2019.
Now my question is that,

1. Can i use winsock or anyother socket API's in my OSdesign
subproject?
how?
2. Where should i look for the required socket library and header
files?
3. Where does the winsock library gets installed? Is it during winCe
installation?

Please suggest.

thanks








.



Relevant Pages

  • Re: using Socket calls in OSdesign subproject
    ... the problem is my windows CE 6.0 Server code that i have shared is ... If it runs on winCE 6.0, ... accept and doesn't accept any client sockets. ... It comes to the level of accpeting socket and blocks there. ...
    (microsoft.public.windowsce.app.development)
  • Re: using Socket calls in OSdesign subproject
    ... The following is the Winsock server code that i am using. ... windows and tested with a winsock client. ... It comes to the level of accpeting socket and blocks there. ...
    (microsoft.public.windowsce.app.development)
  • Re: using Socket calls in OSdesign subproject
    ... The following is the Winsock server code that i am using. ... windows and tested with a winsock client. ... It comes to the level of accpeting socket and blocks there. ...
    (microsoft.public.windowsce.app.development)
  • Re: using Socket calls in OSdesign subproject
    ... The following is the Winsock server code that i am using. ... windows and tested with a winsock client. ... It comes to the level of accpeting socket and blocks there. ...
    (microsoft.public.windowsce.app.development)
  • Re: using Socket calls in OSdesign subproject
    ... The following is the Winsock server code that i am using. ... windows and tested with a winsock client. ... It comes to the level of accpeting socket and blocks there. ...
    (microsoft.public.windowsce.app.development)