Hello Kris,
Basically, I cannot connect to port xxx for sending when I'm already
listening to it...
A socket can send and receive both. UDP Connect is the same as UDP
Listen. So you can not do both. The difference is the handling.
If you call connect then send, then you send to the addr:port in the
properties. LocalAddr:LocalPort are the interface the socket is bound.
If you call listen then you bind to the Addr:Port properties. If you
call Listen you have to send with SendTo.
---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz
Sunday, April 2, 2006, 22:28, Kris Schoofs wrote:
But that's not a problem is it? Listen, connect, send query, wait x
seconds for responses, stop listen, repeat...
I'm unable to execute the sequence you suggest.
Listen to port xxx : OK
Connect to port xxx : 'winsock.bind failed, error #10048'
So, I'm unable to send the query and that's where it ends... Nobody will
respond.
Basically, I cannot connect to port xxx for sending when I'm already
listening to it...
And my guess is that with the sequence I'm currenlty using...
- Connect to port : Send query
- Close port
- Listen to port
...There is too much delay between switching from sending to listening
causing me to miss some of the initial UDP packets.
When running tests I can see 3 scenarios
Either :
(A) I get no packets at all.
= Ethereal shows for every response that was sent to me an ICMP that
reports destination unreachable (Port unreachable). Apparently the socket
is not yet listening...
Or
(B) I only get some of the packets. Usually the first few of the sequence
are missing (the UPnP device I'm currently using sends back 14 packets in
response to my discovery request). Strangely enough, Ethereal does not
report anymore that the destination unreachable (Port unreachable), but
TWSocket also does not make those initial packets available to me.
Or
(C) Sometimes everything works great and I get all packets sent to me (14 in
my test case, as confirmed by Ethereal).
I'm also wondering why sometimes OnDataAvailable is called when listening
but Receive() reports that the received length is -1.
SCENARIO A
- I get nothing back
- Ethereal shows for every response that was sent to me an ICMP that reports
destination unreachable (Port unreachable).
==
Send UDP : Send via port 1171
Send UDP : DONE. Close Socket
LISTEN UDP : listening on port 1171
Listen UDP for 5 seconds : DONE. Close Socket
UDP with ReceiveLength 0 = [00]
UDP with ReceiveLength 1 = [00]
SCENARIO B
- only 11 out of 14 packets
- First 3 packets are missing, see scenario B
==
Send UDP : Send via port 1167
Send UDP : DONE. Close Socket
LISTEN UDP : listening on port 1167
UDP#01=ReceiveLen=249
UDP#02=ReceiveLen=283
UDP#03=ReceiveLen=249
UDP#04=ReceiveLen=283
UDP#05=ReceiveLen=261
UDP#06=ReceiveLen=309
UDP#07=ReceiveLen=296
UDP#08=ReceiveLen=313
UDP#09=ReceiveLen=315
UDP#10=ReceiveLen=305
UDP#11=ReceiveLen=305
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
UDP#**=ReceiveLen=-1
Listen UDP for 5 seconds : DONE. Close Socket
UDP with ReceiveLength 0 = [11]
UDP with ReceiveLength 1 = [10]
SCENARIO C
- I get everything back nicely
==Send UDP : Send via port 1166
Send UDP : DONE. Close Socket
LISTEN UDP : listening on port 1166
UDP#01=ReceiveLen=232
UDP#02=ReceiveLen=243
UDP#03=ReceiveLen=304
UDP#04=ReceiveLen=249
UDP#05=ReceiveLen=283
UDP#06=ReceiveLen=249
UDP#07=ReceiveLen=283
UDP#08=ReceiveLen=261
UDP#09=ReceiveLen=309
UDP#10=ReceiveLen=296
UDP#11=ReceiveLen=313
UDP#12=ReceiveLen=315
UDP#13=ReceiveLen=305
UDP#14=ReceiveLen=305
Listen UDP for 5 seconds : DONE. Close Socket
UDP with ReceiveLength 0 = [14]
UDP with ReceiveLength 1 = [00]
Kris
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Angus Robertson - Magenta Systems Ltd
Sent: zondag 2 april 2006 18:56
To: twsocket@elists.org
Subject: Re: [twsocket] THttpCli and UPnP devices
However, any subsequent attempts to use that same port for sending the
UDP packet fail. Only after closing the socket used for listening I
can use that port for sending a packet.
But that's not a problem is it? Listen, connect, send query, wait x seconds
for responses, stop listen, repeat...
Does Windows not provide an API for UPnP discovery? Certainly Windows
Vista, which I'm currently playing with, has Function Discovery interfaces
that do all this, Vista even found my Linksys wireless access point, mind it
didn't find a proper display adapter and Vista is really painful in VGA.
Angus
--
To unsubscribe or change your settings for TWSocket mailing list please goto