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