I am tring to create a program that will let me loggin to irc... but.. i keep getting
Connecting to server...
NOTICE AUTH :*** Looking up your hostname.....
NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Found your hostname
NOTICE AUTH :*** Got Ident response
ERROR :Closing Link: [[email protected]]
well i made it that far to get it connected.. but it wont give me all the info that it should.. so that i can join a chan etc..
anyways.. here is the code ( please take it easy im new to socket and am really stressed about not remembering somethings so streesed i can cry)
Code:
#define MYPORT 6667
int main( )
{
struct sockaddr_in mysock;
struct sockaddr_in tosock;
struct hostent *addr;
int s_sock, s_conn, x;
int len, s_send, s_recv;
char *p_buff, buff[525];
char *msg;
if((s_sock = socket( AF_INET, SOCK_STREAM, 0 )) == -1 )
{
fprintf( stderr, "Error on SOCKET( )" );
return 1;
}
/* fgets( buff, 20, stdin );
printf("xlordt suxz 1\n");
*/
mysock.sin_family = AF_INET;
mysock.sin_port = htons( MYPORT );
mysock.sin_addr.s_addr = inet_addr( "66.252.6.72" );
if((s_conn = connect( s_sock, ( struct sockaddr *)&mysock, sizeof mysock)) == -1 )
{
fprintf( stderr, "Error on SOCKET( )" );
return 1;
}
printf( "Connecting to server...\n" );
p_buff = buff;
p_buff = (char *)malloc( 64 * sizeof( char ));
for( x=0; x < 25; x++ )
{
if((s_recv = recv( s_sock, p_buff, sizeof p_buff, 0 )) == -1 )
{
fprintf( stderr, "Error on RECV( )" );
return 1;
}
printf( "%s", p_buff );
msg = "PING";
len = strlen( msg );
send( s_sock, msg, len, 0 );
recv( s_sock, p_buff, sizeof p_buff, 0 );
printf( "%s", p_buff );
}
msg="/nick hmmmm";
len = strlen( msg );
if((s_send = send( s_sock, msg, len, 0 )) == -1 )
{
strerror( errno );
return 1;
}
msg="/join #chan";
len = strlen( msg );
if((s_send = send( s_sock, msg, len, 0 )) == -1 )
{
strerror( errno );
return 1;
}
return 0;
close( s_sock );
}
I am just going crazy tring new $$$$ here.. =/