TheCricLinks

Je me pose plein de questions, Internet est un moyen d'y répondre

Nom :

La devise de la France est Liberté - Égalité - Fraternité. Cette devise peut et doit nous aider à trouver le bon chemin.

vendredi 25 novembre 2005

Programmation Socket - Tcp4u's free library for cross-platform development

TCP4U is a Freeware set of libraries that represent a set of APIs that can be used for cross-platform development.

Libraries are available for several varieties Unix and for 16- and 32-bit Windows.

Client and server development is supported through these APIs.
TCP, UDP, SMTP and HTTP protocols are currently supported, and future development might add additional protocols. HTML documentation pages are included, along with sample code.

For instance, your app can create a socket, and connect to the remote host "ftp.ciril.fr"using the "ftp" service in a single call.

In C/C++, this call will be:

int Rc = TcpConnect (& MySocket, "ftp.ciril.fr", "ftp", NULL);

This second sample shows how to write a simple server app. This appwaits for incoming connections on the ftp port then answers "service unavailable".It can be used with any FTP client.

TcpGetListenSocket (& MyListenSocket, "ftp", NULL, 0);
for ( ; ; ) {
TcpAccept (& MyConnSocket, MyListenSocket, 0);
TnSend (MyConnSock, "421 Service unavailable", FALSE, HFILE_ERROR);
TcpClose (& MyConnSock);
}


Now guess how many lines you need to do the same using crude winsocket calls....