[ENet-discuss] Problems getting ENet to work on Solaris
    Eberhart, Andrew 
    andrew.eberhart at intel.com
       
    Mon Sep  8 17:46:05 PDT 2003
    
    
  
When I try using enet_host_service in the client program, the server
crashes with a bus error.
Here is the meat of what I am trying:
client:
   enet_initialize();
   client = enet_host_create (NULL, 1, 0, 0);
   enet_address_set_host (& address, "192.168.90.45");
   address.port = 11234;
   peer = enet_host_connect (client, & address, 2);
   enet_host_service (client, & event, 5000);
   while (1) {
      packet = enet_packet_create ("stuff", strlen("stuff") + 1,
         ENET_PACKET_FLAG_RELIABLE);
      enet_peer_send (peer, 3, packet);
      enet_host_service (client, & event, 5000);
   }
server:
   enet_initialize();
   enet_address_set_host (& address, "192.168.90.45");
   address.port = 11234;
   server = enet_host_create (& address, 32, 0, 0);
   while (1) {
      enet_host_service (server, & event, 1000);
      ...
   }
As soon as the enet_host_service is called on the client after the
enet_peer_send() function, the server gets a bus error.
If I use enet_host_flush() instead of the enet_host_service on the
client, the server does not crash. It behaves as mentioned below.
What am I doing wrong?
			Thanks!
			Andrew
-----Original Message-----
From: Lee Salzman [mailto:lsalzman at telerama.com] 
Sent: Thursday, September 04, 2003 4:51 PM
To: Discussion of the ENet library
Subject: Re: [ENet-discuss] Problems getting ENet to work on Solaris
You need to call enet_host_service() or enet_host_flush() on
the client side. Functions such as enet_peer_send() and
enet_peer_disconnect() only queue requests. 
enet_host_service() must be called after issuing anything 
other than a packet send (connection, disconnection, etc.), 
whereas enet_host_flush() will send out any queued commands 
(in particular, packet sends) but will not handle any acknowledgement 
until enet_host_service() is called (so enet_host_service()
at some point needs to be called if dealing with reliable packets.)
To summarize: ENet works in a "non-blocking" fashion, and doesn't
really do anything until enet_host_service() is called. :)
Lee
On Thu, Sep 04, 2003 at 02:46:42PM -0400, Eberhart, Andrew wrote:
> Hello.
> 
> I am having some problems with ENet on Solaris.
> 
> Disclaimer: I am a SysAdmin (not a programmer), so it a strong
> possibility that I am having usage issues.
> 
> If anyone can help me out with this, I'd appreciate it.
> 
> I tried using the example code from the ENet Tutorial to create a
basic
> client and a server. If it would help to see the code, let me know.
> 
> The client says it is able to connect to the server just fine. It
> reports that a connection is seen (enet_host_service() == 1 and
> event.type == ENET_EVENT_TYPE_CONNECT). At this point, the server does
> not acknowledge anything received. The server is listening with the
> enet_host_service() function.
> 
> Once a packet is sent from the client with enet_peer_send() and then
an
> enet_host_flush(), the server reports it received a new client
> connection. This only occurs when if a call is made to
> enet_host_flush(). It does not do anything if enet_peer_send() is used
> or after the first packet is sent.
> 
> I never see any other activity with the server other than that one
> connect. When the client calls enet_peer_disconnect() and
> enet_peer_reset(), the server does not indicate an
> ENET_EVENT_TYPE_DISCONNECT.
> 
> I have other issues, but I can wait for them. :-) Any help is
> appreciated!
> 
> 			Thanks!
> 			Andrew
> 
> ---
> Andrew Eberhart                    phone: (919) 845-7530
> Intel Americas, Inc.               email: andrew.eberhart at intel.com
> 
    
    
More information about the ENet-discuss
mailing list