Link to home
Start Free TrialLog in
Avatar of Kevin_R
Kevin_R

asked on

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
Avatar of sunnycoder
sunnycoder
Flag of India image

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
Avatar of namus
namus

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...
Avatar of Kevin_R

ASKER

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)
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....
Avatar of Kevin_R

ASKER

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
yes it is possible and is quite simple ... Are you familiar with socket programming ?
Avatar of Kevin_R

ASKER

Its pretty good, Does anyone have any good code that is simple enough to alter if required?
www.ecst.csuchico.edu/~beej/guide/net/html/

has skeletal code for client server architecture .... It can be easily adapted to your requirements
Avatar of Kevin_R

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also to receive a broadcast packet, you will have to set SO_BROADCAST using setsockopt at the receiver

man 7 socket
man setsockopt