socket_connect6(3) Library Functions Manual socket_connect6(3)NAME
socket_connect6 - attempt to make a TCP connection
SYNTAX
#include <socket.h>
int socket_connect6(int s, const char ip[16],
uint16 port,uint32 scope_id);
DESCRIPTION
socket_connect6 attempts to make a connection from TCP socket s to TCP port port on IP address ip.
The meaning of scope_id is dependent on the implementation and IPv6 IP. On link-local IPv6 addresses it specifies the outgoing interface
index. The name (e.g. "eth0") for a given interface index can be queried with getifname. scope_id should normally be set to 0.
socket_connect6 may return
o 0, to indicate that the connection succeeded (and succeeded immediately, if the socket is non-blocking)
o -1, setting errno to error_inprogress or error_wouldblock, to indicate that the socket is non-blocking
o -1, setting errno to something else, to indicate that the connection failed (and failed immediately, if the socket is non-blocking).
When a background connection succeeds or fails, s becomes writable; you can use socket_connected to see whether the connection succeeded.
If the connection failed, socket_connected returns 0, setting errno appropriately.
Once a TCP socket is connected, you can use the read and write system calls to transmit data.
You can call socket_connect6 without calling socket_bind6. This has the effect as first calling socket_bind6 with IP address :: and port
0.
EXAMPLE
#include <socket.h>
int s;
char ip[16];
uint16 p;
s = socket_tcp6();
socket_bind6(s,ip,p);
socket_connect6(s,ip,p,0);
SEE ALSO socket_connect4(3), socket_getifname(3)socket_connect6(3)
Check Out this Related Man Page
socket_send6(3) Library Functions Manual socket_send6(3)NAME
socket_send6 - send a UDP datagram
SYNTAX
#include <socket.h>
ssize_t socket_send6(int s, const char* buf, size_t len,
const char ip[16], uint16 port, uint32 scope_id);
DESCRIPTION
socket_send6 sends len bytes starting at buf in a UDP datagram over the socket s to UDP port port on IP address ip.
You can call socket_send6 without calling socket_bind6. This has the effect as first calling socket_bind6 with IP address :: and port 0.
The meaning of scope_id is dependent on the implementation and IPv6 IP. On link-local IPv6 addresses it specifies the outgoing interface
index. The name (e.g. "eth0") for a given interface index can be queried with getifname. scope_id should normally be set to 0.
RETURN VALUE
socket_send6 returns 0 if the datagram was sent successfully. If not, it returns -1 and sets errno appropriately.
EXAMPLE
#include <socket.h>
int s;
char ip[16];
uint16 p;
uint32 scope_id;
s = socket_tcp4();
socket_bind6(s,ip,p);
socket_send6(s,"hello, world",12,ip,p,scope_id);
SEE ALSO socket_send4(3), socket_getifidx(3)socket_send6(3)
Hello,
I need to make a gateway from Ethernet to RS-485. I am using stream socket, and I am programming in windows nt. I would like to know how could I use some functions from unix in windows nt. I would like to use the function fork(). Which library it uses and how can I get it? Can I... (1 Reply)
I am unable to find any TCP scanner for data captruing for a Remote or local server. Can anybody please help. i need it to read TCP port and capture the incoming/outgoing data , (3 Replies)
Hi, i know how to use socket for TCP applications, i also know how to use RAW socket, but i would like to use socket just over IP and bellow TCP, do you know how to do that ?
i don't want to reimplement IP :)
thanks for your answer. (2 Replies)
Dear experts,
I am seeing a lot of TCP failed connection attempts from "netstat -s" on one of our servers.
How can I pin point what connection failed and what are the ports involved?
Any tools/commands I can dig in deeper to diag. what went wrong on these "failed connection attempts"?
... (2 Replies)
Does anyone know if there is a C API call to get the status of a TCP port? As opposed to running netstat and parsing the results. At the moment I have to attempt to bind() and pick up on the address in use error which isn't very elegant
Thanks
---------- Post updated at 10:42 AM ----------... (0 Replies)
Hello all,
I am loosing the diameter connection between two servers and when the connection is trying to comes up again i see the following message in the tracer.
and after 1 second the connection resets.
As far i know the connection stay in state TIME_WAIT for a while(60 seconds in my... (1 Reply)
will there be any unexpected results on looping connect call for a non blocking socket to determine the connection based on error code. I am getting connection unsuccessful intermittently and so wondering whether is the timeout 500 millisec not sufficient or looping connect cause any unexpected.
... (7 Replies)