Re: Winsock connection

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Cri

I've recently faced a similar problem, but only the server 'end' of it - you might find my observations helpful, even though I don't know all the answers at the client 'end'.

Winsock is an implementation of Sockets, which works on the principle of clients and servers.

If you are writing the server 'end' on a machine with multiple adapters, you can specify which ip address to use in the app, or implement multiple servers, one per adapter, either as separate apps, or as a single app.

If you are writing the client 'end' on a machine with multiple adapters, it gets a bit trickier. The client application will use the best route available to it in the routing table - you can't (to the best of my knowledge) specify which adapter to use at the application level, you need to play around with the routing table etc. Normally though, you wouldn't have both adapters configured to the same subnet, so only one would have a route to your server.

Try looking in the documentation for Socket Client/Server examples and for the IPHelper API functions. Unfortunately the example code for both is a bit flaky.

Good luck, hope this gets you thinking in the right direction.
Tony



Cri++ wrote:
I'm using the "winsock" library in evC++ 4.0.
My device is a WinCE 4.2 PC.
The device have 2 ethernet cards RTL80391 and RTL80392 and every card
have an IP address.
The follow software open a connection and work correctly:
SOCKET g_Sock;
sockaddr* g_p_sock_address;
g_Sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
connect(g_Sock, g_p_sock_address, sizeof(struct sockaddr));

After I'm able to send and receive with:
g_SentLen = send(g_Sock, QueryBuf, QueryBufLen, 0);
// ...
g_RecLen = recv(g_Sock, g_ResponseBuf, sizeof(g_ResponseBuf), 0);

My question is:
can I select witch card (RTL80391 or RTL80392) to use for
communicate? Or the socket auto-select the card.
A connection is composed like
(IP source, Port source --- IP dest., Port dest.),
when a connection is open with "connect" istruction
I can specify the destination IP address but not the source IP address.
Sombody know if can I select the source IP address?

Thanks




.



Relevant Pages

  • Re: Citrix-like solution/many screens
    ... If it really is necessary to have A gfx card per screen so be it, ... I DON'T want a client pc...does that shed ANY light? ... You could then invent ethernet and Tcp/IP to connect the server ... These client machines cost less than character terminals, ...
    (alt.os.linux)
  • Re: Forwarding problem
    ... Our application has a messaging module which runs on the server B. ... This module has to be able to access the infrastructure (server C) ... with SSL using client authentication. ... in order to identify the card, it shall use card signature and public ...
    (microsoft.public.platformsdk.security)
  • Re: CSocket multiple network adapter
    ... and allows the user to specify the server IP or host in command line ... options to the client or client installer in case there is a router between ... The client sends a UDP broadcast, ... there are multiple network adapters at either the client or server. ...
    (microsoft.public.vc.mfc)
  • Re: Trying to connect W2k3 file server with W2k3 DC with no luck
    ... > be enabled is that when I do ipconfig /all it shows that DHCP Enabled ... Are 2 adapters needed for the DC to function properly. ... PLEASE do not confuse the DHCP Server Service with the DHCP Client ...
    (microsoft.public.windows.server.dns)
  • Re: Linux VPN server and client
    ... java card encrypts and decrypts data that is send to my server (writes ... the card and uses it to login to the VPN-Server. ... But use the card as client with the clientcert signed by your CA. ...
    (comp.os.linux.networking)