source: trunk/instant_messenger/socket/BKP_20071105/BKP_20071026/BKP_20071019/BKP_20071018/BKP_20071009/BKP_20071008/BKP/BKP/client_tls.c_bkp2 @ 151

Revision 151, 1.5 KB checked in by niltonneto, 16 years ago (diff)

Commit da nova versão do módulo, usando agente em C.
Vide Página do módulo do Trac:
http://www.expressolivre.org/dev/wiki/messenger

A versão anterior encontra-se na subpasta bkp (32/64).

Line 
1/*#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5#include <sys/socket.h>
6#include <sys/types.h>
7
8#include <netinet/in.h>
9#include <netdb.h>
10#include <unistd.h>
11
12#include <openssl/ssl.h>
13#include <openssl/err.h>
14#include <openssl/crypto.h>
15#include <openssl/x509.h>
16#include <openssl/pem.h>
17#include <openssl/ssl.h>
18#include <openssl/err.h>
19*/
20/* define HOME to be dir for key and certificate files... */
21//#define HOME "/usr/local/ssl/"
22/* Make these what you want for certificate & key files */
23//#define CERT_FILE "mycert.pem"
24//#define KEY_FILE  "mycert.pem"
25
26/*Cipher list to be used*/
27//#define CIPHER_LIST "RC4-MD5"
28
29/*Trusted CAs location*/
30//#define CA_FILE CERT_FILE
31//#define CA_DIR  NULL
32
33/*Password for the key file*/
34//#define KEY_PASSWD ""
35
36//#define IP "im.celepar.parana"
37
38//#define PORT "5222"
39
40#include "server.h"
41
42
43int main(void)
44{
45        int jabber_fd       = (int)NULL,
46                jabber_port     = (int)NULL,
47                jabber_error    = (int)NULL;
48
49        struct sockaddr_in jabber_addr;
50
51        jabber_port = __DEFAULT_JABBER_PORT__;
52        jabber_fd = socket(AF_INET, SOCK_STREAM, 0);
53
54        printf("Socket %d\n", jabber_fd);
55
56        jabber_addr.sin_family = AF_INET;
57        inet_aton(__DEFAULT_JABBER_IP__, &jabber_addr.sin_addr);
58        jabber_addr.sin_port = htons(jabber_port);
59
60        jabber_error = connect(jabber_fd, (struct sockaddr *) &(jabber_addr), sizeof(jabber_addr));
61        printf("Socket returned error #%d, ip = %s and port = %d, program terminated\n", jabber_error, __DEFAULT_JABBER_IP__, __DEFAULT_JABBER_PORT__);
62
63        exit(0);
64}
Note: See TracBrowser for help on using the repository browser.