Server/Client Broadcast/Handshake

Hey,

I was wondering if anyone could help me with the following.
I need a server which will broadcast its ip address over the subnet it is located on.
One or more Clients will be listening for the broadcasts, when received, the clients will reply to the broadcasts with their ip's.
The server/client will then perform a handshake and a connection will be established between the two nodes.

Once a connection is established, both the server and client will print a message saying "Connection Established to [Server/Client ip]

Any help will be greatly appreciated !

Thanks

Kevin
Kevin_RAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sunnycoderConnect With a Mentor Commented:
your clients need to be listening on a predefined port , say 3434

use UDP to broadcast

Broadcast on a network is netid followed by all 1s for host id
e.g. for 192.5.6 network, the boradcast address will be
192.5.6.255
0
 
sunnycoderCommented:
sounds very much like a school project or homework assignment ...

www.ecst.csuchico.edu/~beej/guide/net/html/ 

follow this guide sincerely .... it is the best available on the web .... Once you are comfortable with socket programming and client server architecture (this guide covers it) , we can talk about subnets and multicasting

good luck
0
 
namusCommented:
hey u cud as well read the book
UNIX Network Programming Volume-1 Networking API: Sockets & XTI
--- Richard Stevens.

this book gives u a lotta indepth knowledge abt the TCP connection establishment & various issues concerning with the TCP/IP, practically this is a fine guide. It wud b quite simple for u to do wat u wanna do.. after u read that book..
else u can also browse to the topics u want instead of reading the whole book..
He gives nice code snippets that u cud as well use in ur code.
Dont need to touch the XTI part. Jus read the sockets part in this book... that wud b enuf...

gud luck...
0
Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

 
Kevin_RAuthor Commented:
This is for University, but it isnt assessed work.
Its simply to allow myself and friends to connect to one-another and send files over a wireless network as windows file sharing etc is unavailable as traffic can only be sent/received through port 1494 (citrix)
0
 
namusCommented:
i dunno abt citrix systems, but the work seems to b quite easy... u jus need to get the specifications rite. & take a few things into consideration. like the traffic limitations or bandwidth considerations. Broadcasting wud add a lot of traffic to the existing one. Instead of that, if the IP's of the other hosts r known... u can jus ping or send some packets with icmp echo requests. so that u kno if ur friends r online... then u can start the connection.
if ur friends have dialup connections, ie with no fixed ip's then allowing one of the static ip system to b the server & remaining other systems can follow the procedure to kno if others r online, & proceed. gotta takecare of any firewalls in btwn too. 4 that u need to take the admin's permission....
anyway... gud luck 4 all ur future endevours....
0
 
Kevin_RAuthor Commented:
Ignore the citrix part, Im just saying what its used for.

Basically, Im looking to create a beacon server that will announce itself over the network by sending out a packet on the broadcast ip of the current subnet every few seconds.

Any ideas ?

Thanks
0
 
sunnycoderCommented:
yes it is possible and is quite simple ... Are you familiar with socket programming ?
0
 
Kevin_RAuthor Commented:
Its pretty good, Does anyone have any good code that is simple enough to alter if required?
0
 
sunnycoderCommented:
www.ecst.csuchico.edu/~beej/guide/net/html/

has skeletal code for client server architecture .... It can be easily adapted to your requirements
0
 
Kevin_RAuthor Commented:
How do I make the server broadcast over the subnet its run on, say every 5 seconds.

Also I cant see the string the server sends on client connect anywhere ?

Help !!

Thanks
0
 
sunnycoderCommented:
also to receive a broadcast packet, you will have to set SO_BROADCAST using setsockopt at the receiver

man 7 socket
man setsockopt
0
All Courses

From novice to tech pro — start learning today.