---
name: "socket_tcp4"
section: "3diet"
platform: "linux"
package: "libowfat-dev"
version: "0.28-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/socket_tcp4/3diet"
---

# socket\_tcp4(3diet)

create a non-blocking TCP/IP stream socket

## NAME

socket\_tcp4 - create a non-blocking TCP/IP stream socket

## SYNTAX

**#include \<socket.h\>**

int **socket\_tcp4**();

## DESCRIPTION

socket\_tcp4 creates a non-blocking TCP/IP stream socket and returns a file descriptor pointing to that socket.  If something goes wrong, socket\_tcp4 returns -1, setting errno appropriately, without allocating any resources.

## EXAMPLE

  \#include \<socket.h\>

  int *s*;\
   char *ip*\[4\];\
   uint16 *p*;

  *s* = socket\_tcp4();\
   socket\_bind4(s,ip,p);\
   socket\_connect4(s,ip,p);

## SEE ALSO

[socket\_tcp4b(3)](/socket_tcp4b/3.md), [socket\_bind4(3)](/socket_bind4/3.md), [socket\_bind6(3)](/socket_bind6/3.md)
