Hi,
A suggestion: Have you attempted to change the line:
rcvsock.Bind('0.0.0.0', '0007');
to:
rcvsock.Bind('192.168.1.10', '0007');
Regards,
W
On 03/02/2012 07:18 PM, Dmitri Tsvetikov wrote:
Hi!
I need a UDP terminal to send and receive packets for testing a
microcontroller UDP/IP functionality.
I modified UDPMultiCast demo switching off MultiCast mode:
procedure TForm1.UniCastTest;
var
sndsock: TUDPBlockSocket;
rcvsock: TUDPBlockSocket;
buf: string;
begin
sndsock := TUDPBlockSocket.Create;
rcvsock := TUDPBlockSocket.Create;
try
rcvsock.createsocket;
rcvsock.ConvertLineEnd := true;
rcvsock.Bind('0.0.0.0', '0007'); // if something else then
"destination unreachible"
if rcvsock.LastError <> 0 then exit;
sndsock.createsocket;
sndsock.Bind('0.0.0.0', '0');
sndsock.connect('192.168.1.111','0007');
if sndsock.LastError <> 0 then exit;
sndsock.SendString(edStr.Text + #13#10);
buf := rcvsock.RecvPacket(3000);
// buf := rcvsock.RecvBufferStr(10, 1000);
// buf := rcvsock.RecvString(2000);
Memo1.Lines.Add('>' + buf + '<');
sndsock.CloseSocket;
rcvsock.CloseSocket;
finally
sndsock.free;
rcvsock.free;
end;
end; // UniCastTest
SendString works, I use WireShark to monitor traffic to the controller
MAC address and see that packets are sent to the controller and sent
back (see attachment).
But, RecvPacket (or RecvString) function timeouts without returning
the packet.
I get same result when try RecvString in a thread.
Can anybody see what is wrong with Bind or Connect settings in my code?
Windows XP-SP3, Delphi 7, firewall off.
I tried different port number without success.
Dmitri
------------------------------------------------------------------------------
Virtualization& Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public