After EndAccept new Socket has no LocalEndpoit-Compact Framework o

M

Marcel Kretschmann

Hi,

First of all, this question concerns the usage of sockets for .NET Compact
Framework 3.5.

After accepting a TCP connection via a listening Socket (on IPAddress.Any),
i have the following problem. The new Socket has only 0.0.0.0 as local
EndPoint.
But this Problem only occours if i run my application on the .NET Compact
Framework (Windows CE). The same code running on the normal Framework on my
Desktop PC produces the correct result. (In that case the socket has the
correct IPEndpoint that was used to establish the connection.)

Is this a bug, or do i have to use the system in another way?
 
P

Peter Duniho

Marcel said:
Hi,

First of all, this question concerns the usage of sockets for .NET Compact
Framework 3.5.

There's a .NET Compact Framework forum (a newsgroup, I believe). You
should ask your question there.

That said, your code should not need to know the local endpoint for the
socket. As long as the remote address is returned correctly, I wouldn't
worry about it too much. My guess is that Winsock on the mobile version
of Windows you're using (Windows CE?) is returning that as the address
for the socket, and .NET is simply stuck with whatever behavior the
Winsock API has.

Pete
 
M

Marcel Kretschmann

Hi,

thanks for your awnser.
I needed the information about the local EndPoint, because i try to identify
the IPInterface which was used to receive the incomming connection attempt.
That is because the software should be capable to work with any number of
network cards (an so different networks) paralell.

I managed to get a work arround for the problem, so i do not need to rely on
the information for the local endpoint any more. I now call BeginAccept for
each interface seperately, and use the socket that is bound to the
IPInterfaces local address as the async state object for the BeginAccept
function.
That works pretty well, and is not remarkable slower than only having one
Socket bound to IPAddress.Any.

Greetings
Marcel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top