Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Set remote hostname: (5 Items)
   
Set remote hostname  
Hello,

I'm using QNX 6.2.1 on an embedded  board (I'll call it QNX box). The board is connected to a PC via Ethernet.
I've the network configured and the driver is working fine. I can confirm this by ping the PC from the QNX box with the 
PC's IP address, it all works.

Now I want to write some software to run server-client application. The PC is the server and the QNX box is the client.

I think, I can use the `connect()` function to establish connection with the server. But this function needs know about 
the server. I'm guessing I can use the `gethostbyname()` function to get the server info.

My question is how to find the name of the server? I only know the IP address of the server. May be there is a way to 
assign a name to this IP address in QNX box.

Any help will be appreciated.

Many thanks,
Thanushan
RE: Set remote hostname  
You need to readup on tcpip, it has nothing to do with QNX6.  It also depends on your configuration, do you have a 
DomainNameServer.  You might need one if the address IP of that PC is changing all the time.  You can hard code the ip 
adresse/name in the file /etc/hosts but that will only work if the name of IP adresse of the PC never changes, if it 
never changes than what is the point of using a name ;-)

If you do have a domain name server, check the doc on /etc/resolve.conf

-----Message d'origine-----
De : Thanushan Balakrishnan [mailto:community-noreply@qnx.com] 
Envoyé : Wednesday, July 31, 2013 12:01 AM
À : general-community
Objet : Set remote hostname

Hello,

I'm using QNX 6.2.1 on an embedded  board (I'll call it QNX box). The board is connected to a PC via Ethernet.
I've the network configured and the driver is working fine. I can confirm this by ping the PC from the QNX box with the 
PC's IP address, it all works.

Now I want to write some software to run server-client application. The PC is the server and the QNX box is the client.

I think, I can use the `connect()` function to establish connection with the server. But this function needs know about 
the server. I'm guessing I can use the `gethostbyname()` function to get the server info.

My question is how to find the name of the server? I only know the IP address of the server. May be there is a way to 
assign a name to this IP address in QNX box.

Any help will be appreciated.

Many thanks,
Thanushan



_______________________________________________

General
http://community.qnx.com/sf/go/post103766
To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com

Re: RE: Set remote hostname  
Hi Mario,

Thanks for the help.

The PC has a fixed IP address, it never changes.

My intention is to use the `connect()` function
int connect( int s,
             const struct sockaddr * name,
             socklen_t namelen );

the function needs the 'name' of the server (sockaddr format).

I was thinking of using the `gethostbyname()` will return the info. If there is an easier way, please let me know.
May be I could manually fill in the fields of `sockaddr name`, but I'm bit confused about he sa_data[] field of that 
structure.

Many thanks,
Thanushan
RE: RE: Set remote hostname  
You can use sockaddr_in instead of sockaddr, it use the ip adresse! 

-----Message d'origine-----
De : Thanushan Balakrishnan [mailto:community-noreply@qnx.com] 
Envoyé : Wednesday, July 31, 2013 12:14 AM
À : general-community
Objet : Re: RE: Set remote hostname

Hi Mario,

Thanks for the help.

The PC has a fixed IP address, it never changes.

My intention is to use the `connect()` function int connect( int s,
             const struct sockaddr * name,
             socklen_t namelen );

the function needs the 'name' of the server (sockaddr format).

I was thinking of using the `gethostbyname()` will return the info. If there is an easier way, please let me know.
May be I could manually fill in the fields of `sockaddr name`, but I'm bit confused about he sa_data[] field of that 
structure.

Many thanks,
Thanushan



_______________________________________________

General
http://community.qnx.com/sf/go/post103768
To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com

Re: RE: RE: Set remote hostname  
Thanks Mario,

Looks like that is working.

Thanushan