For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2004 > TCP Broadcast









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author TCP Broadcast
user@domain.invalid

2004-05-12, 9:08 pm

I am writing an application using TCP sockets, I don't know the IP
address of the server and am thinking of using a broadcast to find it.

I am using these examples as a test.
http://www.ecst.csuchico.edu/~beej/...amples/server.c
http://www.ecst.csuchico.edu/~beej/...amples/client.c

How do you modify these so the client will do a broadcast.
I had a guess at using use SO_BROADCAST in programs but it doesn't
appear to change anything.

Thanks
Neil

Barry Margolin

2004-05-12, 9:08 pm

In article <c7mmia$rur$1@au-nws-0001.flow.com.au>, user@domain.invalid
wrote:

> I am writing an application using TCP sockets, I don't know the IP
> address of the server and am thinking of using a broadcast to find it.
>
> I am using these examples as a test.
> http://www.ecst.csuchico.edu/~beej/...amples/server.c
> http://www.ecst.csuchico.edu/~beej/...amples/client.c
>
> How do you modify these so the client will do a broadcast.
> I had a guess at using use SO_BROADCAST in programs but it doesn't
> appear to change anything.


Read the "Broadcasting" chapter of "Unix Network Programming, Vol.1"

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
user@domain.invalid

2004-05-12, 9:08 pm



Barry Margolin wrote:

> In article <c7mmia$rur$1@au-nws-0001.flow.com.au>, user@domain.invalid
> wrote:
>
>
>
>
> Read the "Broadcasting" chapter of "Unix Network Programming, Vol.1"
>


I Don't have that book! Is there an online source of info.



Barry Margolin

2004-05-12, 9:08 pm

In article <c7msba$u4a$1@au-nws-0001.flow.com.au>, user@domain.invalid
wrote:

> Barry Margolin wrote:
>
>
> I Don't have that book! Is there an online source of info.


If you're serious about network programming, you really should get that
book. It's a comprehensive source of answers to many questions about
network programming.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
user@domain.invalid

2004-05-12, 9:08 pm



Barry Margolin wrote:
> In article <c7msba$u4a$1@au-nws-0001.flow.com.au>, user@domain.invalid
> wrote:
>
>
>
>
> If you're serious about network programming, you really should get that
> book. It's a comprehensive source of answers to many questions about
> network programming.
>


I have found the answer, after doing a search and looking though a lot
of WEB pages, I found a hint that I needed to use UDP instead. After
some experiments I got it to work.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com