mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
Implements basic TCP connection logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@326 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+13
-3
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* socket.c
|
||||
* net/socket.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
@@ -129,15 +129,25 @@ int socket(int domain, int type, int protocol)
|
||||
|
||||
/* Initialize the socket structure */
|
||||
|
||||
#ifdef CONFIG_NET_UDP
|
||||
psock = sockfd_socket(sockfd);
|
||||
if (psock)
|
||||
{
|
||||
/* Save the protocol type */
|
||||
|
||||
psock->s_type = type;
|
||||
|
||||
/* Allocate a TCP connection structure */
|
||||
|
||||
psock->s_conn = uip_tcpalloc();
|
||||
if (!psock->s_conn)
|
||||
{
|
||||
/* Failed to reserve a connection structure */
|
||||
|
||||
sockfd_release(sockfd);
|
||||
err = ENFILE;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return sockfd;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user