|
HI
Yes, that was the same idea.
Hmm I not sure that is right. I think we
may be talking about two different things here. I'm talking about making a
connection on a connectionless socket (confused yet?) Reading page 207 of
the "Network programming for Microsoft Windows"... states...
//------------------------
Another method of receiving (and sending)
data on a connectionless socket is to establish a connection. This might
sound strange, but it's not quite what it sound like. Once a
connectionless socket is created, you can call connect or WSAConnect with the
SOCKADDR parameter to set the address of the remote machine to communicate
with. No actual connection is made, however. The socket address
passed into a connection function is associated with the socket so that recv and
WSARecv can be used instead of recvfrom or WSARecvfrom because the data's origin
is known. The ability to connect a datagram socket is handy if you intend
to communicate with only one endpoint at a time in your
application.
//-------------------------
So you think I have to call the bind call on
the client as well as the server and specify the port I think it should
use?? This may well be correct. When I bind the client side to a
port no the program works, its just coincidence that it is the same port no as
the server.
When I tried to use the Connect (from
above) ( with no bind ) Windows assigned the port no to the socket on the
client, I know this as each time I tried to connect to the server (restart
the client app) the port no that the client used increased by one. The
only problem I had with this is that I could only see traffic travelling in one
direction.
Now I read something about things getting bound to
the wrong IP if you do certain things - or if you do them in a certain
order.. I can't really remember ( will have to look it up ) but I think I
may have to bind the client to port 0 to let Windows assign the port? Then
call connect to connect the client to the server??
That's pretty much what happens. Instead of
having a lockable queue I have an event set-up and after the first recv it
signals the event so that it can send the data.
True, however the amount of slowdown doesn't seem
to have any serious problems for what I am doing. Although for another
project I will be working on I defiantly will use IOCP and UDP.
Yeah, pretty much - just the odd niggle that's
been bugging me - such as the bind thing.....
Regards
Max
|
No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.3.0 - Release Date: Mon 21/02/2005
_______________________________________________ msvc mailing list [email protected] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
