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
No.     Time        Source                Destination           Protocol Length 
Info
      1 0.000000    192.168.1.10          192.168.1.111         ECHO     62     
Request

Frame 1: 62 bytes on wire (496 bits), 62 bytes captured (496 bits)
Ethernet II, Src: ZonetTec_80:49:a0 (00:50:22:80:49:a0), Dst: Microchi_00:00:00 
(00:04:a3:00:00:00)
    Destination: Microchi_00:00:00 (00:04:a3:00:00:00)
    Source: ZonetTec_80:49:a0 (00:50:22:80:49:a0)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 192.168.1.10 (192.168.1.10), Dst: 
192.168.1.111 (192.168.1.111)
User Datagram Protocol, Src Port: o2server-port (1894), Dst Port: echo (7)
    Source port: o2server-port (1894)
    Destination port: echo (7)
    Length: 28
    Checksum: 0x5156 [validation disabled]
Echo
    Echo data: 3031323334353637383941424344454647480d0a

No.     Time        Source                Destination           Protocol Length 
Info
      2 0.010311    192.168.1.111         192.168.1.10          ECHO     63     
Response

Frame 2: 63 bytes on wire (504 bits), 63 bytes captured (504 bits)
Ethernet II, Src: Microchi_00:00:00 (00:04:a3:00:00:00), Dst: ZonetTec_80:49:a0 
(00:50:22:80:49:a0)
    Destination: ZonetTec_80:49:a0 (00:50:22:80:49:a0)
    Source: Microchi_00:00:00 (00:04:a3:00:00:00)
    Type: IP (0x0800)
    Trailer: c2
Internet Protocol Version 4, Src: 192.168.1.111 (192.168.1.111), Dst: 
192.168.1.10 (192.168.1.10)
User Datagram Protocol, Src Port: echo (7), Dst Port: o2server-port (1894)
    Source port: echo (7)
    Destination port: o2server-port (1894)
    Length: 28
    Checksum: 0x5156 [validation disabled]
Echo
    Echo data: 3031323334353637383941424344454647480d0a
------------------------------------------------------------------------------
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

Reply via email to