Hi,

When I try a SendTo() address "255.255.255.255" with an UDP listening 
TWSocket I get error WSAEACCES "Permission denied", is this normal?.
SendTo() "192.168.1.255" works, Firewall is turned off.

procedure TMyServer.UdpListen;
begin
  if FUDP = nil then
    FUDP := TWSocket.Create(nil);
  FUDP.Proto             := 'udp';
  FUDP.Addr              := '0.0.0.0'; // listening on one interface doesn't 
change it.
  FUDP.Port              := '30003';
  FUDP.OnDataAvailable   := UdpDataAvailable;
  FUDP.ReuseAddr         := TRUE;
  FUDP.Listen;
end;

procedure TMyServer.SendHelo;
var
  Dst    : TSockAddrIn;
  DstLen : Integer;
  Buf    : AnsiString;
begin
  FillChar(Dst, SizeOf(Dst), 0);
  Dst.sin_family      := AF_INET;
  Dst.sin_port        := WSocket_htons(StrToIntDef(FPort, 30003));
  Dst.sin_addr.S_addr := u_long(INADDR_BROADCAST);
  Buf := 'Helo';
  if FUDP.SendTo(Dst, DstLen, PAnsiChar(Buf), Length(Buf) + 1) = -1 then
    raise Exception.Create(WSocketErrorDesc(WSocket_WSAGetLastError));
end;

-- 
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to