sockets
Mark Bush
bush%prg.oxford.ac.uk at nsfnet-relay.ac.uk
Tue Aug 22 09:51:01 AEST 1989
I've been trying to get an application running and decided that the most
suitable implementation would be using broadcasting over datagram sockets.
I've produced client/server programs that communicated via sockets before
but then the client process connected to a server running on a specified
host. I now want to access information in general across a network.
(I'm using Sun3s running SunOS 3.5)
The first step...RTFM:
>From "Networking on the Sun Workstation", "IPC Primer":
To send a broadcast message, an Internet datagram socket should
be created.
Nothing could be easier.
and at least a port number should be bound to the socket.
Again, this is clear and straightforward.
Then the message should be addressed as:
dst.sin_family = AF_INET;
inet_makeaddr(net, INADDR_ANY);
dst.sin_port = DESTPORT;
Say what?
I can find out what value `net' should be, no problem...this is well
documented, but doesn't `inet_makeaddr()' return an address? Well, needless
to say, I tried what they said and got nothing. Perhaps that line should
have said something like:
dst.sin_addr = inet_makeaddr(net, INADDR_ANY);
I tried that, too. Low and behold I actually managed to get
sendto(s, buf, buflen, 0, &dst, sizeof(dst));
to return the same value as buflen!!! What I want to know is: where did
it go? My server process is continually `polling' its port...in fact it
does a `recvfrom' on its port (DESTPORT) and never returns. I get the
feeling that I'm doing something grossly stupid, but what??!!!??
Mark Bush bush%uk.ac.oxford.prg at ac.uk
Teaching Support Programmer bush%prg.oxford.ac.uk at nsfnet-relay.ac.uk
OUCL ...!uunet!mcvax!ukc!ox-prg!bush
More information about the Comp.unix.wizards
mailing list