Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: (PR#6707) Announce server on LAN
Home

[Freeciv-Dev] Re: (PR#6707) Announce server on LAN

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: andrearo@xxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6707) Announce server on LAN
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Wed, 5 Nov 2003 04:16:12 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Nov 04, 2003 at 07:56:19AM -0800, andrearo@xxxxxxxxxxxx wrote:
> On Mon, 3 Nov 2003, Raimar Falke wrote:
> > So if we choose 224.0.0.1 we know that all hosts are on this group AND
> > we know that the TTL is irrelevant since the packets are routed.
> >
> > The only problem I see is that the server is behind a router. So how
> > do you define LAN?
> >
> > If all this is correct I'm favoring as the default a scan in 224.0.0.1
> > with no special TTL and (optionally if you want to code it) "an export
> > mode" where you can input a special multicast group and optionally a
> > TTL.
> >
> >     Raimar
> 
> I've updated the patch to set the multicast group from
> $FREECIV_MULTICAST_GROUP.   The default value is 224.0.0.1.
> 
> There's nothing in http://www.faqs.org/rfcs/rfc1112.html
> which states that a multicast group address set to
> 224.0.0.1 should be problematic for the applications used here.
> 
> Anyone able to produce problems with this patch now?

I only got over the network code:

This is still wrong:

+  dio_put_uint8(&dout, 1);
+
+  if (sendto(sock, buffer, sizeof(buffer), 0, (struct sockaddr *) &addr,
+      sizeof(addr)) < 0) {

The creation of the sending socket and the listinging socket should be
unified.

The test in
+  group = multicast_group();
+  if (!group) {
+    group = SERVER_LAN_GROUP;
+  }

should be in multicast_group. multicast_group should be renamed to
get_multicast_group.

For the default group no TTL adjustment should be made.

IMHO the GUI code can be unified more. Also there should be no alone
call to close_udp_socket in GUI code. Rename it to
finish_lanserver_scan or similar.

In
+    if (type == SERVER_LAN_VERSION) {
+       freelog(LOG_DEBUG, 
+               "Received request for LAN announcement of server.");
+       send_lanserver_response(); 
+    }
there should be an else case with a warning message.

You know that in
+  if (0 < recvfrom(socklan, msgbuf, sizeof(msgbuf), 0, NULL, NULL)) {
...
+       send_lanserver_response(); 
+  }
the response is send to everybody (in the multicast group)?! Wouldn't
it be better to answer only the client which sent the ping packet?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "The primary purpose of the DATA statement is to give names to
   constants; instead of referring to pi as 3.141592653589793 at every
   appearance, the variable PI can be given that value with a DATA
   statement and used instead of the longer form of the constant. This
   also simplifies modifying the program, should the value of pi
   change."
    -- FORTRAN manual for Xerox Computers



[Prev in Thread] Current Thread [Next in Thread]