For sure you dont want to use getlocalsinport... this will say YOUR
local port not the remote one. You should use GetRemoteSinPort instead
to get the other end port...

And if this fails yet, try calling getsins before reading the packet.

2012/3/9 Dmitri Tsvetikov <dmitri.tsveti...@gmail.com>:
> Thank you Lukas,
>
> i implemented your suggestions,
> now UDP_TxRx app. can receive messages (in a listening thread) from
> identical application on another computer.
>
> Next i tried to convert it to Terminal and Echo app.
> Echo works like this:
> Term sends packet:
> Internet Protocol Version 4, Src: 192.168.1.10, Dst: 192.168.1.100
> User Datagram Protocol, Src Port: ds-user (4403), Dst Port: cbt (7777)
>
> Echo app. receives this packet, displays and sends it back switching source
> and destination ports like this:
> Internet Protocol Version 4, Src: 192.168.1.100, Dst: 192.168.1.10
> User Datagram Protocol, Src Port: pwgpsi (3800), Dst Port: ds-user (4403)
>
> Terminal do not see this message, because it listens on the wrong port
> number.
>
> How can i get source port number of the sent packet (in Terminal app.)?
> I tried this:
>     SndSock.Connect(edSndSockIP.Text, edSndSockPort.Text);
>     if SndSock.LastError <> 0 then exit;
>     Caption := Caption + ' ' + IntToStr(SndSock.GetLocalSinPort);
>     SndSock.SendString(edStr.Text + #13#10);
>     Caption := Caption + ' ' + IntToStr(SndSock.GetLocalSinPort);
> It returns 0. I was hoping to get something similar to 4403.
>
> Because this is the port that is supposed to listen for echo message.
>
> How to receive this echo packet?
>
> Best regards,
> Dmitri
>
>
>
> On Mon, Mar 5, 2012 at 11:29 PM, Lukas Gebauer <gebyl...@mlp.cz> wrote:
>>
>> > Returned packet seems in order. Is it possible that Synapse is just
>> > dropping the packet because there is something wrong? Could this option
>> > be
>> > turned off temporarily?
>>
>> 1. Do not use "rcvsock.ConvertLineEnd := true;" on non-stream sockets.
>>
>> 2. Call of CreateSocket is not needed. Socket will be created automaticky
>> by Synapse.
>>
>> 3. call of "sndsock.Bind('0.0.0.0', '0');" is not needed too. It is
>> default value.
>>
>>
>> --
>> Lukas Gebauer.
>>
>> http://synapse.ararat.cz/ - Synapse Delphi and Kylix TCP/IP Library
>> http://geoget.ararat.cz/ - Geocaching solution
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>
>
>
> ------------------------------------------------------------------------------
> 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
>

------------------------------------------------------------------------------
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