Solved

Server/Client Broadcast/Handshake

Posted on 2004-03-26
13
368 Views
Last Modified: 2010-04-15
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
0
Comment
Question by:Kevin_R
  • 5
  • 4
  • 2
13 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10693465
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
 

Expert Comment

by:namus
ID: 10695048
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
 

Author Comment

by:Kevin_R
ID: 10695894
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
 

Expert Comment

by:namus
ID: 10696044
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
 

Author Comment

by:Kevin_R
ID: 10696114
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 45

Expert Comment

by:sunnycoder
ID: 10702020
yes it is possible and is quite simple ... Are you familiar with socket programming ?
0
 

Author Comment

by:Kevin_R
ID: 10704394
Its pretty good, Does anyone have any good code that is simple enough to alter if required?
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10704782
www.ecst.csuchico.edu/~beej/guide/net/html/

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

Author Comment

by:Kevin_R
ID: 10708452
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
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 10710610
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
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10721469
also to receive a broadcast packet, you will have to set SO_BROADCAST using setsockopt at the receiver

man 7 socket
man setsockopt
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now