Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Ip to long conversion question

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

Bascom Member



Joined: 25 Jun 2007
Posts: 11

blank.gif
PostPosted: Wed Mar 12, 2008 2:03 pm    Post subject: Ip to long conversion question Reply with quote

hallo,
i have a convertion question about a long variable.
when i use this syntax
result = socketconnect( socket, ip, port) i read this in Bascom's Help
The IP number of the server you want to connect to.
This may be a number like 141.100.250.141 or a LONG variable that is assigned with an IP number.
Note that the LSB of the LONG, must contain the MSB of the IP number.


i want to know,how we make the conversion from ip in this form(141.100.250.151) to a long variable, and from a long variable to a ip in this form(141.00.250.151).

thanks
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun Apr 06, 2008 11:05 am    Post subject: Conversion Reply with quote

Check this for conversion IP to LONG and Vise Versa...



&H19 = 25
&H00 = 0
&HA8 = 168
&HC0 = 192

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Frankeman

Bascom Member



Joined: 11 Aug 2004
Posts: 948
Location: the Netherlands

netherlands.gif
PostPosted: Sun Apr 06, 2008 11:35 am    Post subject: Reply with quote

To make a conversion from 141.100.250.141 to a variable of the type word use the MAKETCP command.

Frank.
Back to top
View user's profile
Arera

Bascom Member



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

germany.gif
PostPosted: Mon Apr 07, 2008 7:09 am    Post subject: Reply with quote

Frankemann wanted to say

To make a conversion from 141.100.250.141 to a variable of the type LONG use the MAKETCP command..

Just to avoid confusion...
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