Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Socket Problem

 
Post new topic   Reply to topic Printable version
 View previous topic  WYSIWYG F1 Editor (v. 1.1) Post :: Post FACTs SRC?  View next topic  
Author Message
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Tue Jan 13, 2004 5:45 pm    Post subject: Socket Problem Reply to topic Reply with quote

Should this code below connect to the IRC server and go to the IRC channel #worldchat? because I tried and I don't see my program going in the channel when I'm in there I see no Dude w/e I named it entering.
Here is the code:
Code: Show/Hide
#include <iostream.h>
#include <winsock.h>
int main()


    {
    char myname[17] = " NICK Dude008\r\n";
    char myuserid[38] = "USER random \"S\" \"127.0.0.1\" :random\r\n";
    char mychan[18] = "JOIN #worldchat\r\n";
       cout << "A tiny IRC program\n";
       WSADATA WsaDat;
       if (WSAStartup(MAKEWORD(1,1), &WsaDat) != 0)


           {
           cout << "Error: Failed to start Winsock\n";
              return 0;
           }
           SOCKET mysocket;
           mysocket = socket(AF_INET, SOCK_STREAM, 0);
           SOCKADDR_IN SockAddr;
           SockAddr.sin_port = htons(6667);
        SockAddr.sin_family = AF_INET;
        SockAddr.sin_addr.S_un.S_un_b.s_b1 = 66;
        SockAddr.sin_addr.S_un.S_un_b.s_b2 = 252;
        SockAddr.sin_addr.S_un.S_un_b.s_b3 = 1;
        SockAddr.sin_addr.S_un.S_un_b.s_b4 = 55;
           if (connect(mysocket, (SOCKADDR *)(&SockAddr), sizeof(SockAddr)) == SOCKET_ERROR)


               {
                  cout << "Error: Socket could not connect\n";
                  return 0;
               }
               send(mysocket, myname, sizeof(myname), 0);
            cout << "Sent nick\n";
            Sleep(MAKEWORD(10,10));
            send(mysocket, myuserid, sizeof(myuserid), 0);
            cout << "Sent user id\n";
            Sleep(MAKEWORD(10,10));
            send(mysocket, mychan, sizeof(mychan), 0);
            cout << "Joining #WorldChat\n";
            Sleep(MAKEWORD(10,10));
            return 0;
        }


plz help this is what I'm stuck so far o yea and also too send a chat msg in irc I just use send(mysocket, msghere,sizeof(msghere),0);
and should it send something to the chat after I connect?
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Wed Jan 14, 2004 7:00 pm    Post subject: Reply to topic Reply with quote

hmmm guess no one knows how too then Grrrr this sucks now........
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2579
Location: USA
Offline

PostPosted: Thu Jan 15, 2004 3:58 pm    Post subject: Reply to topic Reply with quote

never learned c++ sockets :/
Back to top
View users profile Send private message Add User to Ignore List
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Thu Jan 15, 2004 6:11 pm    Post subject: Reply to topic Reply with quote

NVM I got it too enter finally but just now getting the msg sorted out which that will be a pain!!!!
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Misc User Apps All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 64 page(s) served in previous 5 minutes.

phpBB Created this page in 0.163004 seconds : 28 queries executed (65.9%): GZIP compression disabled