lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] UDP with different clients


From: Jim Gibbons
Subject: Re: [lwip-users] UDP with different clients
Date: Fri, 27 Aug 2004 13:06:49 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707

I don't believe that it is appropriate to use netconn_listen for UDP.  You may want to check the documentation.

You may also want to disconnect after you send your reply.  It probably isn't good form to repeatedly connect without ever disconnecting.  It would also be wise to renew the connection with each reception.  The other party to this communication may not use the same port for every transmission.

Urs Gerber wrote:
Hi,

I try to connect udp with any remotadress and I can receive the message from
the client.
Now, if I give a answer to this message, I connect the client with the
received adress and port and
send the answer.
This part work only for two times and after there, I will not received any
message!

What I have to do, that its work all the time?

My code is:
  conn = netconn_new(NETCONN_UDP);          /* Create a new UDP connection
handle. */
  netconn_bind(conn, NULL, 7000);
  netconn_listen(conn);                     /* Put the connection into
LISTEN state. */

  /* Loop forever. */
  while(1) {
    buf = netconn_recv(conn);                /* receive data form the other
host */
    if (buf != NULL) {
      netconn_connect(conn,buf->fromaddr,buf->fromport);       /* Connect
the connection to the remote host */
      netbuf_data(buf, (void **)&rq, &len);  /* Get the data from netbuf */
      netbuf_delete(buf);                    /* delete data buffer */

      buf = netbuf_new();             /* Buffer allozieren */
      netbuf_ref(buf,File,usTotalLen);
      netconn_send(conn,buf);

    }
  }

regards,
Urs




_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
  

--
E-mail signature
Jim Gibbons
address@hidden
Gibbons and Associates, Inc.
TEL: (408) 984-1441
900 Lafayette, Suite 704, Santa Clara, CA
FAX: (408) 247-6395



reply via email to

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