Hey. I'm trying to use TWSocket to send UDP messages to many different hosts. I want to create the TWSocket dynamically, and I don't want to have to use Connect/Close every time I send a UDP message. I thought I could use the SendTo() procedure to do this, but I have had no success. This is my test code to send one UDP message to myself (it doesn't work):
procedure Test(); var DestAddr: TSockAddr; Data: string; begin SocketOut := TWSocket.Create(nil); // create the socket SocketOut.Proto := 'udp'; // set it to use UDP (shouldnt really need this) ZeroMemory(@DestAddr, SizeOf(DestAddr)); // clear the address DestAddr.sin_family := AF_INET; // we have to use AF_INET DestAddr.sin_port := 600; // set the port to 600 DestAddr.sin_addr.S_addr := WSocket_inet_addr('127.0.0.1'); // point to self Data := 'Hello world'; // the message we want to send SocketOut.SendTo(DestAddr, SizeOf(DestAddr), @Data[1], Length(Data)); // send // nb: SocketOut is freed later end; Could anyone point out to me what I'm doing wrong. :) Thanks - Shane -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be