public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Networking problem.
@ 2001-01-22 11:06 Eric Monsler
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Monsler @ 2001-01-22 11:06 UTC (permalink / raw)
  To: cygwin

Hi,

I'm having a problem with a rather small cygwin project.  I installed
the latest net release as of 01/04/2001.

I've written a server application that opens a serial port, opens a
network socket and binds to a UDP port, and then waits for traffic on
one or the other.

Under cygwin, it initially seemed to compile and run properly, and two
such applications would bounce messages between each other on the serial
ports.

After writing the client application and attempting to test the UDP
connectivity, the server never receives UDP packets under cygwin.  

If I rerun "./configure" and re-make under Solaris, the server will
receive UDP packets and respond as expected.  It works both when the
client uses 127.0.0.1 from the same machine, or for a client on another
machine using the IP of the Sun.

Since the calls to socket, bind, and select all seem to succeed, and the
code runs under Solaris, I'm not quite sure how to proceed with
debugging this problem.  Any suggestions?  Relevent code snippets are
below.

TIA,

Eric Monsler


/* This code opens the socket and binds it to a UDP port */
int init_udp_if(void)
{
  
  int	sockfd;
  int	bind_ret;

  int len;
  struct sockaddr_in boundaddr;

  /* Create the Socket */
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
#if DEBUG
  printf("Opening socket returned: %d\n", sockfd);
#endif
  if(sockfd < 0)
    {
      /* Error, return fail */
      return sockfd;
    }

  /* Clear and initialize server address structure */
  memset(&servaddr, 0x0, sizeof(servaddr));

  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servaddr.sin_port = (AV_DEFAULT_UDP_PORT);

  /* Bind our socket to the desired port
	"Bind" wraps "bind" and checks return value. */
  Bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
  
  len = sizeof(boundaddr);
  getsockname(sockfd, (struct sockaddr *)&boundaddr, &len);
  printf("Socket bound to IP 0x%08x port %d\n", 
	 boundaddr.sin_addr.s_addr,
	 boundaddr.sin_port);

  return sockfd;
      
}


/*
	This is the pending for message portion of the server code
*/

  while(!(have_msg))
    {
      /* Clear and set up file descriptor array, descriptors read for
     reading, for 'select' */

      //      printf("About to FD_ZERO\n");

      FD_ZERO(&rset);

      /* Set up fd_set and call select. */
      FD_SET(udp_socket_fd,&rset);
      FD_SET(serial_fd,&rset);
      maxfdp = MAX(udp_socket_fd,serial_fd) +1;
      
      /* Now pend on our input file descriptors, until data is
	 available or unti we timeout. */
      sel_ret = select(maxfdp, &rset, NULL, NULL, &sel_timeout);

      /* Check if we timed out.  If so, increment a counter; if not,
	 try to read data */
      if(sel_ret == 0)
	{
	  /* We timed out! */
	  /* Do some metrics, or something */

	  printf("Timed out waiting for messages\n");
	}
      else
	{
	  /* Check if we have UDP data to get */
	  if( FD_ISSET(udp_socket_fd,&rset) )
	    {
	      unsigned long 	ip_msg_sender;
	      unsigned short	port_msg_sender;
	      unsigned long	msg_length;
	      
	      /* Try to receive a message!
	     
		 If data is available, it should be a whole packet */

	      printf("Reading UDP datagram\n");
 	      /* Code deleted */
	    }
	  
	  /* Check if we have Serial data to get */
	  if( FD_ISSET(serial_fd,&rset) )
	    {
	      /* Try to receive a message!
		 
		 Note that 'data' available in the serial interface
		 does not mean that the whoe message is available! */
	      unsigned long	msg_length;

	      printf("Reading Serial data\n");

	      /* Code Deleted */	      
	    }	   
	}
    }

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Networking problem
  2002-03-25  9:34   ` Christopher Faylor
@ 2002-03-25  9:44     ` Larry Hall (RFK Partners, Inc)
  0 siblings, 0 replies; 6+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-03-25  9:44 UTC (permalink / raw)
  To: cygwin

At 12:06 PM 3/25/2002, Christopher Faylor wrote:
>On Mon, Mar 25, 2002 at 09:46:50AM -0500, Larry Hall (RFK Partners, Inc) wrote:
> >At 01:02 AM 3/25/2002, Rajaraman B wrote:
> >>There is no support for IP_HDRINCL socket option.  Many header files
> >
> >Check out Winsock capabilities in this area.  Cygwin's socket support
> >is dependent on Winsock functionality.
>
>Of course patches to augment Cygwin are always cheerfully accepted, too.
>If Winsock can do it, then Cygwin should be able to do it.



Good point.  Thanks for picking up on this rather large omission of the
facts on my part.



Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Networking problem
  2002-03-25  6:50 ` Larry Hall (RFK Partners, Inc)
  2002-03-25  7:14   ` Jesper Eskilson
@ 2002-03-25  9:34   ` Christopher Faylor
  2002-03-25  9:44     ` Larry Hall (RFK Partners, Inc)
  1 sibling, 1 reply; 6+ messages in thread
From: Christopher Faylor @ 2002-03-25  9:34 UTC (permalink / raw)
  To: cygwin

On Mon, Mar 25, 2002 at 09:46:50AM -0500, Larry Hall (RFK Partners, Inc) wrote:
>At 01:02 AM 3/25/2002, Rajaraman B wrote:
>>There is no support for IP_HDRINCL socket option.  Many header files
>
>Check out Winsock capabilities in this area.  Cygwin's socket support
>is dependent on Winsock functionality.

Of course patches to augment Cygwin are always cheerfully accepted, too.
If Winsock can do it, then Cygwin should be able to do it.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Networking problem
  2002-03-25  6:50 ` Larry Hall (RFK Partners, Inc)
@ 2002-03-25  7:14   ` Jesper Eskilson
  2002-03-25  9:34   ` Christopher Faylor
  1 sibling, 0 replies; 6+ messages in thread
From: Jesper Eskilson @ 2002-03-25  7:14 UTC (permalink / raw)
  To: cygwin

"Larry Hall (RFK Partners, Inc)" <lhall@rfk.com> writes:

> Check out Winsock capabilities in this area.  Cygwin's socket support is 
> dependent on Winsock functionality.

If you want to be able to send and receive raw ethernet frames, your best
be is to take a look at WinPcap. (Use Google; I don't have the exact URL in
my head).

-- 
/Jesper


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Networking problem
  2002-03-24 23:59 Rajaraman B
@ 2002-03-25  6:50 ` Larry Hall (RFK Partners, Inc)
  2002-03-25  7:14   ` Jesper Eskilson
  2002-03-25  9:34   ` Christopher Faylor
  0 siblings, 2 replies; 6+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-03-25  6:50 UTC (permalink / raw)
  To: Rajaraman B, cygwin

At 01:02 AM 3/25/2002, Rajaraman B wrote:
>Hi,
>     There is no support for IP_HDRINCL socket option. Many header files


Check out Winsock capabilities in this area.  Cygwin's socket support is 
dependent on Winsock functionality.



Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Networking problem
@ 2002-03-24 23:59 Rajaraman B
  2002-03-25  6:50 ` Larry Hall (RFK Partners, Inc)
  0 siblings, 1 reply; 6+ messages in thread
From: Rajaraman B @ 2002-03-24 23:59 UTC (permalink / raw)
  To: cygwin

Hi,
    There is no support for IP_HDRINCL socket option. Many header files
are missing. does cygwin really support full fledged networking as in
linux? can you please help me how to do full fledged network porgramming
using cygwin?

Thanks,
Rajaraman. B


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-03-25 17:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-22 11:06 Networking problem Eric Monsler
2002-03-24 23:59 Rajaraman B
2002-03-25  6:50 ` Larry Hall (RFK Partners, Inc)
2002-03-25  7:14   ` Jesper Eskilson
2002-03-25  9:34   ` Christopher Faylor
2002-03-25  9:44     ` Larry Hall (RFK Partners, Inc)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).