dear friends ,
           i am working for UDP socket connection betn
two palm os simulators , but connection is not
establishing no data is received to server.....
           here is my code for the server , client is
working fine , it sends the data continuosly ..

static void Connect(void)
{

        UInt16          ifErrs;
    Err err;
    UInt32              ifCreator;
        UInt16          ifInstance;

err = NetLibIFGet(AppNetRefnum1, 0, &ifCreator,
&ifInstance);
   err=NetLibOpen(AppNetRefnum1, &ifErrs);
        
        int sockfd;
        struct sockaddr_in my_addr;    // my address
information
        struct sockaddr_in their_addr; // connector's
address information
        int addr_len, numbytes;
        char buf[10]={};
        Err errno;

//        sockfd = socket(AF_INET, SOCK_DGRAM, 0);
        if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0))
== -1) 
        {
                                FrmAlert(SocketAlert);
        }



        my_addr.sin_family = AF_INET;         // host
byte order
        my_addr.sin_port = htons(1600);     // short,
network byte order
        my_addr.sin_addr.s_addr = htonl(INADDR_ANY);
// automatically fill with my IP
        bzero(&(my_addr.sin_zero), 8);        // zero
the rest of the struct

    
         if (bind(sockfd, (struct sockaddr *)&my_addr,
sizeof(struct sockaddr)) == -1)
         {
                        FrmAlert(BindAlert);
         }

        
        addr_len = sizeof(struct sockaddr);
      
        if ((numbytes=recvfrom(sockfd,buf,sizeof(buf),
0,(struct sockaddr *)&their_addr, &addr_len)) == -1) 
         {
         FrmAlert(RecAlert);
        }

        buf[numbytes]='\0';
        
        WinDrawChars(buf,numbytes,30,30);       
               
                        close(sockfd);    
}

==========================
any help in this regard will be greately appreciated
!!!!!!!!
Regards........ 
         Rahul Choube & sachin
                

________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and 
more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to