doc: update function network_connect_to (plugin API reference)
This commit is contained in:
parent
afa432af25
commit
1c3c7b01db
@ -11995,6 +11995,8 @@ This function is not available in scripting API.
|
||||
|
||||
==== weechat_network_connect_to
|
||||
|
||||
_Updated in version 0.4.3._
|
||||
|
||||
Establish a connection to a remote host.
|
||||
|
||||
[IMPORTANT]
|
||||
@ -12006,37 +12008,33 @@ Prototype:
|
||||
[source,C]
|
||||
----
|
||||
int weechat_network_connect_to (const char *proxy,
|
||||
int sock,
|
||||
unsigned long address,
|
||||
int port);
|
||||
struct sockaddr *address,
|
||||
socklen_t address_length);
|
||||
----
|
||||
|
||||
Arguments:
|
||||
|
||||
* 'proxy': proxy name to use
|
||||
* 'sock': socket to use
|
||||
* 'address': address
|
||||
* 'port': port
|
||||
* 'address': address to connect to (with port)
|
||||
* 'address_length': length of argument 'address'
|
||||
|
||||
Return value:
|
||||
|
||||
* 1 if connection is ok, 0 if an error occurred
|
||||
* socket number (>= 0) if connection is OK, -1 if an error occurred
|
||||
|
||||
C example:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr *addr;
|
||||
socklen_t length;
|
||||
unsigned long address;
|
||||
int sock;
|
||||
|
||||
memset (&addr, 0, sizeof (struct sockaddr_in));
|
||||
length = sizeof (addr);
|
||||
getsockname (sock, (struct sockaddr *) &addr, &length);
|
||||
addr.sin_family = AF_INET;
|
||||
address = ntohl (addr.sin_addr.s_addr);
|
||||
/* allocate/set address and port in 'addr', set 'length' */
|
||||
/* ... */
|
||||
|
||||
if (weechat_network_connect_to (NULL, sock, address, 6667))
|
||||
sock = weechat_network_connect_to (NULL, addr, length);
|
||||
if (sock >= 0)
|
||||
{
|
||||
/* OK */
|
||||
}
|
||||
|
@ -12210,6 +12210,8 @@ Cette fonction n'est pas disponible dans l'API script.
|
||||
|
||||
==== weechat_network_connect_to
|
||||
|
||||
_Mis à jour dans la version 0.4.3._
|
||||
|
||||
Établit une connexion à une machine distante.
|
||||
|
||||
[IMPORTANT]
|
||||
@ -12221,37 +12223,33 @@ Prototype :
|
||||
[source,C]
|
||||
----
|
||||
int weechat_network_connect_to (const char *proxy,
|
||||
int sock,
|
||||
unsigned long address,
|
||||
int port);
|
||||
struct sockaddr *address,
|
||||
socklen_t address_length);
|
||||
----
|
||||
|
||||
Paramètres :
|
||||
|
||||
* 'proxy' : nom du proxy à utiliser
|
||||
* 'sock' : socket à utiliser
|
||||
* 'address' : addresse
|
||||
* 'port' : port
|
||||
* 'address' : adresse où se connecter (avec le port)
|
||||
* 'address_length' : longeur du paramètre 'address'
|
||||
|
||||
Valeur de retour :
|
||||
|
||||
* 1 si la connexion est ok, 0 en cas d'erreur
|
||||
* numéro de socket (>= 0) si la connexion est OK, -1 en cas d'erreur
|
||||
|
||||
Exemple en C :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr *addr;
|
||||
socklen_t length;
|
||||
unsigned long address;
|
||||
int sock;
|
||||
|
||||
memset (&addr, 0, sizeof (struct sockaddr_in));
|
||||
length = sizeof (addr);
|
||||
getsockname (sock, (struct sockaddr *) &addr, &length);
|
||||
addr.sin_family = AF_INET;
|
||||
address = ntohl (addr.sin_addr.s_addr);
|
||||
/* allouer/définir l'adresse et le port dans 'addr', définir 'length' */
|
||||
/* ... */
|
||||
|
||||
if (weechat_network_connect_to (NULL, sock, address, 6667))
|
||||
sock = weechat_network_connect_to (NULL, addr, length);
|
||||
if (sock >= 0)
|
||||
{
|
||||
/* OK */
|
||||
}
|
||||
|
@ -12219,6 +12219,9 @@ Questa funzione non è disponibile nelle API per lo scripting.
|
||||
|
||||
==== weechat_network_connect_to
|
||||
|
||||
// TRANSLATION MISSING
|
||||
_Updated in version 0.4.3._
|
||||
|
||||
Stabilisce una connessione con un host remoto.
|
||||
|
||||
[IMPORTANT]
|
||||
@ -12231,38 +12234,37 @@ Prototipo:
|
||||
[source,C]
|
||||
----
|
||||
int weechat_network_connect_to (const char *proxy,
|
||||
int sock,
|
||||
unsigned long address,
|
||||
int port);
|
||||
struct sockaddr *address,
|
||||
socklen_t address_length);
|
||||
----
|
||||
|
||||
Argomenti:
|
||||
|
||||
* 'proxy': nome del proxy da utilizzare
|
||||
* 'sock': socket da utilizzare
|
||||
* 'address': indirizzo
|
||||
* 'port': porta
|
||||
// TRANSLATION MISSING
|
||||
* 'address': address to connect to (with port)
|
||||
// TRANSLATION MISSING
|
||||
* 'address_length': length of argument 'address'
|
||||
|
||||
Valore restituito:
|
||||
|
||||
* 1 se la connessione è andata a buon fine, 0 in
|
||||
caso di errore
|
||||
// TRANSLATION MISSING
|
||||
* socket number (>= 0) if connection is OK, -1 if an error occurred
|
||||
|
||||
Esempio in C:
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[source,C]
|
||||
----
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr *addr;
|
||||
socklen_t length;
|
||||
unsigned long address;
|
||||
int sock;
|
||||
|
||||
memset (&addr, 0, sizeof (struct sockaddr_in));
|
||||
length = sizeof (addr);
|
||||
getsockname (sock, (struct sockaddr *) &addr, &length);
|
||||
addr.sin_family = AF_INET;
|
||||
address = ntohl (addr.sin_addr.s_addr);
|
||||
/* allocate/set address and port in 'addr', set 'length' */
|
||||
/* ... */
|
||||
|
||||
if (weechat_network_connect_to (NULL, sock, address, 6667))
|
||||
sock = weechat_network_connect_to (NULL, addr, length);
|
||||
if (sock >= 0)
|
||||
{
|
||||
/* OK */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user