LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2004, 05:31 AM   #1
quentusrex
Member
 
Registered: Aug 2004
Location: Seattle, Washington
Posts: 101

Rep: Reputation: 15
[C/C++]-Networking-How to find the server on this network


Hey, I have a piece of software that has a server and a client version. It is designed to work on a network set up for like a home or school. something with the 192.168.whatever.whatever. Well.... I need to write the code that would allow for the client to find the server. Here's the catch. I can't hardcode the server's ip into the client and I can't tell it to the client. I need the client to broadcast a general 'hello.......?' message to find the server. How would I do this? I was thinking that I would send a packet to the ip 192.168.1.255 since the ip range is only from 192.168.1.1-254(i'm pretty sure).

Any helpful Ideas?

oh, how would I find out the source ip from a packet?I have the client listening for a response to it's 'ping' and i need to know how to get the ip of the sender of the response so that this ip can be used at the server's ip.

Thanks!
 
Old 10-25-2004, 04:55 PM   #2
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Is there a fixed port that server listens? If so, you can try to connect that port -say 5000- of the IPs 192.168.0.0/16 sequentially. If there can be conflicts because of the usage of a commonly used port, a confirmation word can be used after connecting the destination host.

Also you can find the sender IP and other protocol header informations by using the raw sockets or tcpdump's libpcap library.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't find driver in networking gui (FC4) (Zydas 1211) Officer Dibble Linux - Wireless Networking 1 11-02-2005 06:07 AM
cant find over server name over network dave13 Linux - Networking 2 06-13-2005 11:48 AM
Need to find books on Linux networking with Mac OSX maelstrom209 Linux - Networking 4 03-02-2005 01:52 PM
Networking in a windows network NL-Stitch Linux - Newbie 1 08-01-2004 01:00 PM
networking linux to a windows network? farneyboy Linux - Newbie 5 01-22-2004 09:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration