Hi,
I am looking to be able to connect to an IRC server in a C program. I have followed some instructions from an old book I have however it doesn't seem to be working. I've tried connecting to localhost on my ssh port and it still doesn't want to work.
This is what I have so far as a piece of skeleton test code:
Code:
#include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<unistd.h>
#include<netinet/in.h>
#include<arpa/inet.h>
int main(int argc, char **argv) {
int sockfd;
int len;
struct sockaddr_in address;
int result;
sockfd=socket(AF_INET,SOCK_STREAM,0);
address.sin_family = AF_INET;
address.sin_addr.s_addr=inet_addr("194.1.163.1");
address.sin_port=6667;
len=sizeof(address);
result=connect(sockfd,(struct sockaddr *)&address, len);
if (result==-1) {
fprintf(stderr,"Error: Couldn't connect to server\n");
exit(-1);
}
return 0;
}
Could someone please tell me where I'm going wrong!?
Cheers,
[edit]
Btw, the address is an efnet one.