Re: using Socket calls in OSdesign subproject



You don't want to restrict your bind(). That's more-restrictive and not
what we want for purposes of making this work. As I said, YOUR CODE WORKS
ON MY DEVICE. From that, I conclude that, if the network is set up
correctly, the client is trying to connect to the wrong IP or, if the client
is correct, the network is broken. You don't have the Windows CE firewall
on your device?

I can't tell you how *your* device works. I think that, generally, the same
IP used during EBoot is passed along to the VMini driver in Windows CE
running on top of KITL, so nothing has to change, but maybe you aren't doing
that. I can't remotely diagnose things at that level. Can the client ping
your device's IP address? You should be able to find the IP address by
getting a command prompt and using 'ipconfig /all', just as you would on the
desktop.

Paul T.

"vinay" <vinay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9E3F5E46-887D-4E3E-B7D1-1A384DA032E9@xxxxxxxxxxxxxxxx
Hi,

I checked if there is any firewall between WinCE target and my client but
even after disabling the firewall and using direct ethernet connection,
still
it doesn't work.
I tried to use the following IP address directly instead of INADDR?_ANY,

ocal.sin_family=AF_INET; //Address family
local.sin_addr.s_addr=inet_addr("192.168.16.10");// INADDR_ANY; //Wild
card
IP address
local.sin_port=htons(44444); //port to use
The IP address 192.168.16.10 has been configured in E-boot. In this case
bind fails with error code 10049. This means the server is not able to
bind
to this IP. Even though i'm able to ping to this IP, it is not binding and
it
returns.

If i USe INADDR_ANY, bind succeeds but the client is unable to connect and
times out.
I would like to konw, is it enough that, the IP address is configured at
E-boot or at the WinCE Os level is it necessary to set the IP address?
With these observations, it looks like the IP address is not properly set
in
WinCE!
Is there any way to check which IP address the server binds to when i use
INADDR_ANY option?
Please suggest.

thanks


"Paul G. Tobey [eMVP]" wrote:

I don't buy it. There's nothing wrong with that code. My guesses are:

1. Your client is not connecting to the right IP, the right port, etc.
2. Your Windows CE device is running the firewall and your port is
blocked
by the firewall.
3. There is a firewall between the client and the Windows CE device and
that
firewall is blocking the connection.

Paul T.

"vinay" <vinay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:99B4D90C-3BD0-40E3-9BA4-6F5DB906E26D@xxxxxxxxxxxxxxxx
I'm sorry, the problem is my windows CE 6.0 Server code that i have
shared
is
not working. It comes the point where the accept function is called and
blocks at that point. It is not accepting any clients. The same server
code i
tried on windows XP and works fine. If it runs on winCE 6.0, it blocks
on
accept and doesn't accept any client sockets. My client is throwing
error
code 10060 when connect fails. This error code corresponds to "Client
timedout to connect to server".I'm not sure why my WinCE server is not
accepting any client connections!. This is the problem and i'm new to
WinCE
and need suggestions to debug and resolve the problem.

thanks

"Paul G. Tobey [eMVP]" wrote:

YOU HAVE NOT TOLD ME WHAT IS GOING WRONG! How am I supposed to solve
a
problem when I don't know the symptoms?

Paul T.

"vinay" <vinay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:181C8B83-506C-4401-8DF4-719F69580AB9@xxxxxxxxxxxxxxxx
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: Socket switch delay
    ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Locking on async calls
    ... you must synchronize the entire SendMessage routine as an atomic ... operation to prevent mixed messages from being transmitted to the server. ... You are correct that read and write on the socket do not interfere with each ... If you want to handle multiple client connections from one server object ...
    (microsoft.public.dotnet.general)
  • Re: Design issue with WinSock/GetQueuedCompletionStatus
    ... delegate that to a shutdown routine called after all worker threads ... The application I've created is a server accepting connections on a few ... different TCP/IP ports and then lets the client run different commands. ... a TCP/IP socket can be closed for 2 different reasons: ...
    (microsoft.public.win32.programmer.networks)
  • Re: socket communication: socket doesnt connect
    ... Microsoft MVP, MCSD ... As far as your server code goes, ... accept the listening socket. ... Client client = new Client; ...
    (microsoft.public.vc.language)
  • Re: TCP server stop receiving new connections
    ... reset the event mask of your listening socket each time you ... I have a strange problem in my class library used by all our client ... server applications. ... incomming connections, but keeps current connections. ...
    (microsoft.public.win32.programmer.networks)