CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Posts
    2

    yahoo protocol problems

    Hello


    I have been developing a yahoomessenger chat client for nintendos handheld gaming console 'nintendo ds'.Till now i have finished laying out the user interface and wifi access via router.

    I found the yahoo protocol in many places from a google search but i am unable to understand how to send the preliminary information




    <------- 4B -------><------- 4B -------><---2B--->
    +-------------------+-------------------+---------+
    | Y M S G | version | pkt_len |
    +---------+---------+---------+---------+---------+
    | service | status | session_id |
    +---------+-------------------+-------------------+
    | |
    : D A T A :
    | 0 - 65535* |
    +-------------------------------------------------+



    i have the following code in my program.For ds dev i am using palib which has inbuilt socket commands which i am using.


    i did the following but unsure if i am doing it right.So i came here with some hope that someone will know if i am doing something wrond

    Code:
    // Includes
    #include <PA9.h>       // Include for PA_Lib
    
    #define YAHOO_PAGER_HOST "scs.msg.yahoo.com"
    #define YAHOO_PAGER_PORT 5050
    #define y_version  9 
    #define YAHOO_SERVICE_AUTH  0x57
    #define TEST_USERNAME "ramakrishna_rapur"
    
    #define statav 0
    
    
    
         struct /*structstuff*/ packet
        {
           char header[4];
           int  version;
           short pkt_len;      // String length
           int service;      // The operation for the packet
           int  status;      
           int  session;      
           unsigned char data[65536]; 
    
       };
       
       
      
      
       
       packet StructToSend;
    
    // Function: main()
    int main(int argc, char ** argv)
    {
       
      
    	PA_Init();    // Initializes PA_Lib
    	PA_InitVBL(); // Initializes a standard VBL
    	PA_InitText(1,0);
                   PA_InitText(0,0); //initialize text cretaion on bothscreens
                    PA_OutputSimpleText(1,5,5,"yahoo test 1.");//output sometext
    	PA_InitWifi(); //Initializes the wifi
          
       //all this code is for connecting to a wifi router
       PA_OutputSimpleText(1,10,21,"connecting via DHCP..");
    	int i;
    		Wifi_AutoConnect(); // request connect
    		while(1) 
    		{
    			i=Wifi_AssocStatus(); // check status
    			if(i==ASSOCSTATUS_ASSOCIATED) 
    			{
    			   PA_OutputSimpleText(1,22,22,"connected!"); 
    			   break;
    			}   
    			      if(i==ASSOCSTATUS_CANNOTCONNECT) 
    					{
    				PA_OutputSimpleText(1,18,22,"disconnected!");
                    while(1);
    				break;
    			}
    }			
    
    // trying to fill packet struct contents but unsure if its the right way
        StructToSend.header[0]='Y';
    
        StructToSend.header[1]='M';
    
        StructToSend.header[2]='S';
    
        StructToSend.header[3]='G';
        
        StructToSend.version= y_version;
        
        StructToSend.service= YAHOO_SERVICE_AUTH;
        
        StructToSend.status= statav;
        
       
        
        
       
       
    
    	 
    	 int sock; //declare socket
    //initialize socket on y server on port 5050
    	 PA_InitSocket(&sock,YAHOO_PAGER_HOST,YAHOO_PAGER_PORT,PA_NORMAL_TCP);   
    
    //send struct
    	 send(sock,&StructToSend,256,0);
    	
    //receive date from y server
    	    char buffer[256];
    	    recv(sock,buffer,256,0);
    	    
    	 
    	
    
    
    	// Infinite loop to keep the program running
    	while (1)
    	{
    	   PA_OutputText(0, 12, 13, "%s", buffer);
    	   	PA_WaitForVBL();
    	   
    	}
    	
    	return 0;
    } // End of main()
    i tried running this simple sending a packet to yahoo server and print the incoming data but it seems i dont get data back ie nothing is being printed on the screen

  2. #2
    Join Date
    Oct 2005
    Location
    Bangalore
    Posts
    1,051

    Re: yahoo protocol problems

    did you try debugging your code, to see where is it that your program fails ?

    Also just in case you have not already done this, you should be able to download the source for Gaim ( an universal IM ) from sourceforge.net, and look at how they have implemented support for yahoo.
    - Sreehari
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
    " Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin

  3. #3
    Join Date
    May 2007
    Posts
    2

    Unhappy Re: yahoo protocol problems

    hi hari thanks for replying.

    i checked out gaim and it itself is based on another library called purple lib.i tried to serch for actual protocol done in code in c in vain.i need this help.
    also i am doing something like this for the first time so i dont even know if i am doing is correctly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured