/[pengfork]/pengfork/src/cable.c
ViewVC logotype

Diff of /pengfork/src/cable.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by chupa, Sun Sep 1 14:31:07 2002 UTC revision 1.3 by lordheavy, Mon Sep 2 11:20:24 2002 UTC
# Line 24  Line 24 
24    
25  #ifdef WITH_CABLE  #ifdef WITH_CABLE
26    
27    #include <unistd.h>
28  #include <stdio.h>  #include <stdio.h>
29  #include <stdlib.h>  #include <stdlib.h>
30    #include <string.h>
31    
32    #include <sys/types.h>
33  #include <sys/socket.h>  #include <sys/socket.h>
34  #include <net/if.h>  #include <net/if.h>
35  #include <netinet/in.h>  #include <netinet/in.h>
36  #include <fcntl.h>  #include <netdb.h>
37    
38  #include "options.h"  #include "options.h"
39    
# Line 44  cable_getfd () Line 48  cable_getfd ()
48  int  int
49    cable_connect ()    cable_connect ()
50  {  {
51  /*  int port = PARAM_CABLE_AOL_PORT;    int port = PARAM_CABLE_AOL_PORT;
52    char *hostname = PARAM_CABLE_AOL_HOST;    char *hostname = PARAM_CABLE_AOL_HOST;
53    
54    struct sockaddr_in intcable;    struct sockaddr_in intcable;
55    struct hosten *hp;    struct hostent *hp;
56    
57    if ((hp = gethostbyname (hostname))== 0)    if ((hp = gethostbyname (hostname))== 0)
58      {      {
# Line 59  int Line 63  int
63    intcable.sin_family = AF_INET;    intcable.sin_family = AF_INET;
64    intcable.sin_port = htons(port);    intcable.sin_port = htons(port);
65    intcable.sin_addr.s_addr = *((unsigned long *) hp->h_addr);    intcable.sin_addr.s_addr = *((unsigned long *) hp->h_addr);
66    strcpy(PARAM_CABLE_CONNECT_IP,inet_ntoa(adresse));  //  strcpy(PARAM_CABLE_CONNECT_IP,inet_ntoa(adresse));
67    
68    if ((cablefd = socket (PF_INET, SOCK_STREAM, 0))<0)    if ((cablefd = socket (PF_INET, SOCK_STREAM, 0))<0)
69      {      {
# Line 70  int Line 74  int
74    
75    if (connect (cablefd, (struct sockaddr *) &intcable, sizeof (struct sockaddr_in)) == 0)    if (connect (cablefd, (struct sockaddr *) &intcable, sizeof (struct sockaddr_in)) == 0)
76      return 1;      return 1;
77  */  
78    return 0;    return 0;
79  }  }
80    
81  int  int
82    cable_close ()    cable_close ()
83  {  {
84  /*  if (cablefd != -1)    if (cablefd != -1)
85      {      {
86      if ((close (cablefd)) == -1)      if ((close (cablefd)) == -1)
87        {        {
88        perror ("error closing socket !\n");        perror ("error closing socket !\n");
89        return -1;        return 1;
90        }        }
91        return 0;        return 0;
92      }      }
93    perror ("error closing socket !\n");    perror ("error closing socket !\n");
94    return -1;    return 1;
 */  
   return 0;  
95  }  }
96    
97  int  int

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26