Forum > Networking and Web Programming

lNet Base UDP fail to SendMessage with 22: Invalid Argument on Mac OS X

(1/1)

Shebuka:
Hi all, the problem is all in subject, after a while debugging my application i'v created a small test project that also doesn't work.
Can you see what i'm doing wrong? (basicaly it's console example lupd.pp with gui but wothout server)

I don't have a Linux machine to test on till Monday, but i'v tested it on Win and it worked...

Shebuka:
I'v tried the same example code on Linux Ubuntu and it works without errors, so it's definitely a Mac OS X bug.

I'v also tried to update to fpc 2.6.0 and Lazarus SVN with no success.

Shebuka:
Found solution:


--- Code: ---function TLSocket.DoSend(const aData; const aSize: Integer): Integer;
var
  AddressLength: Longint = SizeOf(FPeerAddress);
begin
  if FSocketType = SOCK_STREAM then
    Result := Sockets.fpSend(FHandle, @aData, aSize, LMSG)
  else
    case FAddress.IPv4.sin_family of
      LAF_INET  :
        begin
          AddressLength := SizeOf(FPeerAddress.IPv4);
          Result := sockets.fpsendto(FHandle, @aData, aSize, LMSG, @FPeerAddress.IPv4, AddressLength);
        end;
      LAF_INET6 :
        begin
          AddressLength := SizeOf(FPeerAddress.IPv6);
          Result := sockets.fpsendto(FHandle, @aData, aSize, LMSG, @FPeerAddress.IPv6, AddressLength);
        end;
    end;

    //Result := sockets.fpsendto(FHandle, @aData, aSize, LMSG, @FPeerAddress.IPv4, AddressLength);
end;
--- End code ---

and filled bug report: http://bugs.freepascal.org/view.php?id=21112

Navigation

[0] Message Index

Go to full version