Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

GETDSTPort ()

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
maxer123

Bascom Member



Joined: 26 Oct 2007
Posts: 4

blank.gif
PostPosted: Fri Oct 26, 2007 3:30 pm    Post subject: GETDSTPort () Reply with quote

Hello,

I have established the WWW serwer, as was presented in example (easy tcp/ip file). OK. It is working fine. The remote web browser takes all information from server. I work on 80 port as (usually).

I tried to start the instruction GETDSTPORT (), but it returns different port number every time the web browser takes information from server. Sometimes the port number is bigger than 64000 (double bytes).

How to change it to return the correct port number ?

Regards,

Peter
Laughing
Back to top
View user's profile
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

germany.gif
PostPosted: Wed Dec 12, 2007 2:07 pm    Post subject: Reply with quote

I´ve got an answer and a question:

My answer:
I experienced the same as you did: large numbers, chanching on every connection. I connect on port 23 to use telnet. Only Port 23 is forwarded in my router, so I´m quiet shure to really use port 23.
As you experienced, everything works fine, we are not to worry about that issue.

My question:
What is the deeper meaning of that getdstport result?
Back to top
View user's profile
maxer123

Bascom Member



Joined: 26 Oct 2007
Posts: 4

blank.gif
PostPosted: Tue Dec 18, 2007 5:23 pm    Post subject: GETDSTPORT Reply with quote

Hi,

I would like to know the port number just for testing and security purpose. When I check this port number I will be really sure that application and client are transmitting information using this same port. Of course when communication is established and data are transferred I am able to be sure – good communication is a serious argument.

The port number reported by GETDSTPORT is really completely different from PC network tool – for example <<netstat>>. It is hardly to understand from which “place” this number has been taken. javascript:emoticon('Laughing')
Laughing

May be the bug inside routine GETDSTPORT or some inconsistency ?javascript:emoticon('Question')
Question


Best regards
Back to top
View user's profile
lmb_nl

Bascom Member



Joined: 13 Nov 2007
Posts: 4

blank.gif
PostPosted: Wed Dec 19, 2007 9:22 am    Post subject: Reply with quote

Correct me if I'm wrong .....

When you connect to a webserver on port 80, the real connection is established on a different port, because otherwise the webserver wouldn't be able to accept a new connection.

But here it comes . . . (from the manual)

Action

Returns the port number of the peer.

Syntax

Result = GETDSTPort( socket)

Remarks

Result
A WORD variable that is assigned with the port number of the peer or destination port number.

Socket
The socket number.

When you are in server mode, it might be desirable to detect the port number of the connecting client.

You can use this for logging, security, etc.


A webbrowser could use any port to initiate the connection from. IMHO there isn't a fixed port from which you're browser would connect.

It is possible to use a fixed port number (not listening but from which you connect) but you have to program it you're self. Webbrowser won't.
Back to top
View user's profile
maxer123

Bascom Member



Joined: 26 Oct 2007
Posts: 4

blank.gif
PostPosted: Mon Jan 07, 2008 5:00 pm    Post subject: GETDSTPort Reply with quote

Hello,

It is really difficult to correct your arguments because you are right !!!

But may you have an idea why the port number reported by Bascom GETDSTPort is different then reported by the other software. I checked the contents of adequate datagrams (during the session) and it is really different.

I suppose that this port number is delivered in decimal form and can be direct presented on LCD. Am I right ? or some extra “manipulation” should be used (hex or MSB translation)

Best regards,
Back to top
View user's profile
maxer123

Bascom Member



Joined: 26 Oct 2007
Posts: 4

blank.gif
PostPosted: Mon Jan 07, 2008 5:00 pm    Post subject: GETDSTPort Reply with quote

Hello,

It is really difficult to correct your arguments because you are right !!!

But may you have an idea why the port number reported by Bascom GETDSTPort is different then reported by the other software. I checked the contents of adequate datagrams (during the session) and it is really different.

I suppose that this port number is delivered in decimal form and can be direct presented on LCD. Am I right ? or some extra “manipulation” should be used (hex or MSB translation)

Best regards,
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum