Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Dod
Hello Angus, I have a SocketServer because it's the way to make a listening UDP server isn't it ? It listen for incoming UDP on port 1812, I subclassed it to add some more properties. When OnDataAvailable I try to send UDP data back to sender but with same 1812 src port and

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Angus Robertson - Magenta Systems Ltd
I have a SocketServer because it's the way to make a listening UDP server isn't it ? No!! TSocketServer is designed for TCP, not UDP, it listens on a port for a new connection then transfers that connection to a new socket for each client. UDP is connectionless and only supports

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Angus Robertson - Magenta Systems Ltd
And he used TWSocketServer and since then I always used the same way too. No idea how that worked, maybe the client was using a different port to reply. TMySocketServer If you have been making use of the TSocketServer client to save application data for the reply, you'll need a rethink.

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Dod
Hello Angus, ARMSL No idea how that worked, maybe the client was using a different port to ARMSL reply. Absolutely, my other programs never needed to re-use same src port so I never got the problem. ARMSL If you have been making use of the TSocketServer client to save ARMSL application data

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Hoby Smith
: [twsocket] Force UDP source port when sending Hello Angus, ARMSL No idea how that worked, maybe the client was using a different port to ARMSL reply. Absolutely, my other programs never needed to re-use same src port so I never got the problem. ARMSL If you have been making use

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Dod
] Force UDP source port when sending HS Hello Angus, ARMSL No idea how that worked, maybe the client was using a different port HS to ARMSL reply. HS Absolutely, my other programs never needed to re-use same src port so HS I never got the problem. ARMSL If you have been making use

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Dod
Hello Angus, Still not working but I found something, if I do a .SendTo inside the OnDataAvailable after the .ReceiveFrom, it works, no bind error, but in my program I have to pass the received data to some worker queue that take some seconds to produce the answer and then when it tries to

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Angus Robertson - Magenta Systems Ltd
May be I need to do something more if I .SendTo outside OnDataAvailable ? I would have thought not, but make sure the public variable is not being corrupted by another received packet meanwhile, it should be kept for the FIFO queue. I use SendTo in my IP Logger component, which will send and

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Dod
Hello Angus, I just tested it on a Vista machine and it works, no bind error, back to the original NT4 machine (I know its old but we still use some NT4 servers that work perfectly) and I get bind error ?!? regards. -- To unsubscribe or change your settings for TWSocket mailing list please

Re: [twsocket] Force UDP source port when sending

2008-07-02 Thread Dod
Hello Angus, Just for experience, I tried with my old bad TWSocketServer way of use, and get the bind error under Vista/XP too, so your advices has been very helpfull as I can now make it work under Vista/XP, but I need to make it work on NT4 :-( regards. -- To unsubscribe or change

Re: [twsocket] Force UDP source port when sending

2008-07-01 Thread Dod
Hello Angus, I still get Bind error using this (simplified) code :-( procedure TFormMain.WSocketListenerDataAvailable(Sender: TObject; ErrCode: Word); begin TMySocketServer(sender).ReceiveFrom(@BufRadiusAnswerDataAvailable,512,SrcSocket,SrcSocketLen); try

Re: [twsocket] Force UDP source port when sending

2008-07-01 Thread Angus Robertson - Magenta Systems Ltd
TMySocketServer Why are you using this component, UDP needs only TWSocket, or have you subclassed TWSocket for some reason? But this stuff works in numerous other applications, there must be something else in error in your application that is causing bind to fail. Angus -- To unsubscribe

Re: [twsocket] Force UDP source port when sending

2008-06-28 Thread Dod
Hello Angus, Thank you, so I cannot force the port to same as listening but if I do it within the OnDataAvailable then the .SendTo will automatically re-use the same socket to send data back using same src port whenever this port is actually used for listening by the server ? So this also

Re: [twsocket] Force UDP source port when sending

2008-06-28 Thread Angus Robertson - Magenta Systems Ltd
: [twsocket] Force UDP source port when sending *From:* Dod [EMAIL PROTECTED] *To:* ICS support mailing twsocket@elists.org *Date:* Sat, 28 Jun 2008 18:06:32 +0200 Hello Angus, Thank you, so I cannot force the port to same as listening but if I do it within the OnDataAvailable then the .SendTo

[twsocket] Force UDP source port when sending

2008-06-25 Thread Dod
Hello, I have an application (EXE file without sources) that listen UDP on port 1812 and when it receive data, it send an UDP paquet back to sender with same source 1812 port. I have to do same application but I get exception already binded if I use MySocket.LocalPort:=1812 to send

Re: [twsocket] Force UDP source port when sending

2008-06-25 Thread Angus Robertson - Magenta Systems Ltd
So question is : how to force UDP port source when sending it whenever this port is used by a listener socket as the other application do ? May be thru sockaddr_in structure ? Yes, this is the (simplified) code from the ICS SNTP Time Server that responds to a UDP request with the time to the