hostlen, portlen;
82 char*
buf, port[16];
89portlen = (size_t) sprintf(port,
":%hu", xxx->
port) + 1
;
90hostlen = strlen(xxx->
host);
91 buf= (
char*)
malloc(hostlen + portlen);
93memcpy(
buf, xxx->
host, hostlen);
94memcpy(
buf+ hostlen, port, portlen);
174(
"[%s%s%s] Too many failed attempts (%hu), giving up",
176descr && *descr ?
"; ":
"",
292 unsigned shorttry_own,
303 if(!sock && !host && !port)
317 if(sock || !host || !port) {
322xxx->
host= strcpy((
char*) xxx +
sizeof(*xxx), host);
330 char*
addr= (
char*) xxx +
sizeof(*xxx);
335xxx->
try_own= try_own ? 1 : 0;
338 char* temp = (
char*) xxx +
sizeof(*xxx);
347xxx->
host= strcpy(temp + xxx->
size, host);
349xxx->
try_own= try_own ? try_own : 1;
371 unsigned shortmax_try)
380 unsigned shortmax_try,
391 unsigned shortown_sock)
393 return s_Init(sock, 0, 0, own_sock, 0, 0, 0);
399 unsigned shortown_sock,
400 const char* hostport)
402 return s_Init(sock, hostport, 0, own_sock, 0, 0, 0);
CONNECTOR SOCK_CreateConnectorEx(const char *host, unsigned short port, unsigned short max_try, const void *data, size_t size, TSOCK_Flags flags)
FSetupVTable setup
init meta, may not be NULL
#define CONN_SET_METHOD(meta, method, function, connector)
CONNECTOR SOCK_CreateConnectorOnTop(SOCK sock, unsigned short own_sock)
CONNECTOR next
linked list
const STimeout * default_timeout
default timeout pointer
FDestroy destroy
destroys handle, can be NULL
CONNECTOR SOCK_CreateConnector(const char *host, unsigned short port, unsigned short max_try)
void * handle
data handle of the connector
SMetaConnector * meta
back link to original meta
CONNECTOR SOCK_CreateConnectorOnTopEx(SOCK sock, unsigned short own_sock, const char *hostport)
void SOCK_GetPeerAddress(SOCK sock, unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order)
Get host and port of the socket's peer (remote end).
EIO_Status SOCK_SetTimeout(SOCK sock, EIO_Event event, const STimeout *timeout)
Specify timeout for the connection I/O (see SOCK_[Read|Write|Close]()).
unsigned int SOCK_HostToNetLong(unsigned int value)
See man for the BSDisms, htonl() and htons().
EIO_Status SOCK_Close(SOCK sock)
Close the SOCK handle, and destroy all relevant internal data.
EIO_Status SOCK_Read(SOCK sock, void *buf, size_t size, size_t *n_read, EIO_ReadMethod how)
Read/peek up to "size" bytes from "sock" to a buffer pointed to by "buf".
EIO_Status SOCK_Status(SOCK sock, EIO_Event direction)
Return low-level socket I/O status of *last* socket operation.
EIO_Status SOCK_Wait(SOCK sock, EIO_Event event, const STimeout *timeout)
Block on the socket until either the specified "event" is available or "timeout" expires (if "timeout...
EIO_Status SOCK_CreateEx(const char *host, unsigned short port, const STimeout *timeout, SOCK *sock, const void *data, size_t size, TSOCK_Flags flags)
[CLIENT-side] Connect client to another(server-side, listening) socket (socket() + connect() [+ selec...
int SOCK_ntoa(unsigned int addr, char *buf, size_t bufsize)
Convert IP address to a string in dotted notation.
EIO_Status SOCK_Write(SOCK sock, const void *data, size_t size, size_t *n_written, EIO_WriteMethod how)
Write "size" bytes of "data" to "sock".
unsigned int TSOCK_Flags
bitwise "OR" of ESOCK_Flags
EIO_Event
I/O event (or direction).
@ eIO_Success
everything is fine, no error occurred
@ eIO_InvalidArg
bad argument / parameter value(s) supplied
@ eIO_ReadPlain
read readily available data only, wait if none
@ eIO_WritePlain
write as much as possible, report back how much
@ eIO_Close
also serves as an error indicator in SOCK_Poll
static const CS_INT unused
const struct ncbi::grid::netcache::search::fields::SIZE size
#define CORE_LOGF_X(subcode, level, fmt_args)
const char g_kNcbiSockNameAbbr[]
static CONNECTOR s_Init(SOCK sock, const char *host, unsigned short port, unsigned short try_own, const void *data, size_t size, TSOCK_Flags flags)
static char * s_VT_Descr(CONNECTOR connector)
static EIO_Status s_VT_Write(CONNECTOR connector, const void *buf, size_t size, size_t *n_written, const STimeout *timeout)
static EIO_Status s_VT_Read(CONNECTOR connector, void *buf, size_t size, size_t *n_read, const STimeout *timeout)
static const char * s_VT_GetType(CONNECTOR connector)
static EIO_Status s_VT_Close(CONNECTOR connector, const STimeout *timeout)
static const char * x_GetType(SSockConnector *unused)
static EIO_Status s_VT_Open(CONNECTOR connector, const STimeout *timeout)
static void s_Setup(CONNECTOR connector)
static EIO_Status s_VT_Status(CONNECTOR connector, EIO_Event dir)
static EIO_Status s_VT_Wait(CONNECTOR connector, EIO_Event event, const STimeout *timeout)
static void s_Destroy(CONNECTOR connector)
static char * x_Descr(SSockConnector *xxx)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4