lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] What is a PCB and why don't I have any?


From: ake . forslund
Subject: Re: [lwip-users] What is a PCB and why don't I have any?
Date: Fri, 17 Jun 2011 10:43:44 +0200

The telnet client is the client provided by windows XP so can't provide the source code for it. The server thread on my platform is using sockets (LWIP_COMPAT_SOCKETS) and looks like this:

void task_socket_recv(void * arg)
{
  int lSocketRecv, new_fd;
  u32_t lAddrSize;
  struct addrinfo *sListenAddr, hints;
  char buffer[1024];
  int nbytes;
  LWIP_DEBUGF(SOCKETS_DEBUG, ("Recv Task started!\n"));
  memset((char *)&hints, 0, sizeof(struct addrinfo));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  lwip_getaddrinfo("0.0.0.0", "23", &hints, &sListenAddr);
   
  lSocketRecv = lwip_socket(sListenAddr->ai_family, sListenAddr->ai_socktype, sListenAddr->ai_protocol);
 
 
  lwip_bind(lSocketRecv, (struct sockaddr *)&sListenAddr, sizeof(sListenAddr));
 
  while (1)
  {
    os_dly_wait(100);
    lwip_listen(lSocketRecv, 128);
    lAddrSize = sizeof(sListenAddr);
    new_fd = lwip_accept(lSocketRecv, (struct sockaddr *)&sListenAddr, &lAddrSize);
    nbytes = lwip_read(new_fd, buffer, sizeof(buffer));
    lwip_write(new_fd, "Welcome to the jungle\n", 22);
    if (nbytes > 0)
      LWIP_DEBUGF(SOCKETS_DEBUG, ("Recv\n\r"));
  }
}

The thread stops in lwip_accept() -> netconn_accept() where it is waiting for sys_arch_mbox_fetch(&conn->acceptmbox, (void **)&newconn, conn->recv_timeout) to get an answer of some sort.


/Åke

-----------------------------
Åke Forslund
0433-273296
NIBE AB
Box 14
S-285 21  Markaryd
Tel +46-(0)433-273296



From: Kieran Mansley <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Date: 2011-06-17 10:32
Subject: Re: [lwip-users] What is a PCB and why don't I have any?
Sent by: address@hidden





On Fri, 2011-06-17 at 09:54 +0200, address@hidden wrote:
> my question is what is a PCB in this context and where are they
> created?
> Are they created with the socket or somewhere else?

Which API are you using in your telnet client?  Can you share the code
with us?

Kieran


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



reply via email to

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