Find the answer to your Linux question:
Results 1 to 5 of 5
i am using windowsxp in one pc and another running on fedora 11,,, i develop socket based applications which run on fedora linux. But i need to test these applications ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3

    Exclamation unable to connect to windowsxp sockets

    i am using windowsxp in one pc and another running on fedora 11,,, i develop socket based applications which run on fedora linux. But i need to test these applications with a software running on windows xp. i found that i could not connect to socket of the application running on fedora from an application running on windows. i am not able to identify the problem. can anybody tell me why this is happening. should i try any other linux distribution ?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    More information please. Sample source code, system configuration, etc. would be useful. I've done a lot of windows -> Unix/Linux programming without any problems.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3
    Thank u for you reply,

    infact pinging the windows machine from fedora machine and vice-versa was successfull, but still i could not connect / receive / accept the connections in any machines.

    i thried tthe following cases ans have given the status at as OK/NOT OK.

    linux server - linux client -OK
    linux server - windows client -NOT OK
    windows server - linux client -NOT OK
    windows server - windows client -OK



    In fact i recently tried the same code on PCQlinux 2005, and the same worked. but i need to run the same on fedora instead of PCQLinux.


    my system conf:

    Windows machine:
    OS: WINXP
    intel core 2 duo 2.66 Ghz, 3 GB RAM , i am not aware of ethernet card

    Fedora 11 machine:
    intel P-IV , 3 GHz , 2 GB RAM ,, Ethernet card : Broadcom NetExtreme card

    i am enclosing socrce code also
    server code:RUNS ON FEDORA 11



    int MyReceive();
    void CreateUDPSocket();
    int Sock,port;
    #define DATASIZE 10000

    struct DataToRecv
    { int PktNo;
    char data[DATASIZE];
    };

    struct DataToRecv *MyData;


    char SRCIPADDR[20]={"172.16.2.224"};
    int SRCPORT=4568;

    char DESTIPADDR[20]={"172.16.3.33"};
    int DESTPORT=4567;


    int main()
    {

    MyReceive();


    return 1;
    }




    /**************************************/
    int MyReceive()
    {

    FILE *ReveivedData;

    ReveivedData=fopen("ReveivedData.dat","w");

    int status;
    CreateUDPSocket();
    char *Data;
    MyData= new struct DataToRecv;
    Data=(char*)MyData;
    for(int i=0;i<100;i++)
    {
    status=recv(Sock,Data,sizeof(struct DataToRecv),0);
    fprintf(ReveivedData,"PktNo= %d\n",MyData->PktNo);
    fprintf(ReveivedData,"%s\n",MyData->data);

    printf("after reception %d %s PktNo=%d\n",status,MyData->data,MyData->PktNo);
    }


    return(status);
    }

    /**************************************/
    void CreateUDPSocket()
    {

    Sock=socket(AF_INET,SOCK_DGRAM,0);
    struct sockaddr_in name;
    int namelen;

    name.sin_family = AF_INET;
    name.sin_addr.s_addr = inet_addr(SRCIPADDR);
    name.sin_port = htons(SRCPORT);

    namelen=sizeof(name);
    bind(Sock,(struct sockaddr *)&name,namelen);




    }



    clinent code: RUNS ON WINXP

    void MySend();
    void CreateUDPSocket();
    int SendData(struct DataToSend ,int size);
    int Sock,port;
    #define DATASIZE 10000
    struct DataToSend
    { int PktNo;
    char data[DATASIZE];
    };

    struct DataToSend MyData;

    char SRCIPADDR[20]={"172.16.2.224"};
    int SRCPORT=4567;
    char DESTIPADDR[20]={"172.16.3.33"};
    int DESTPORT=4568;
    /**************************************/

    int main()
    {

    MySend();


    return nRetCode;
    }


    void MySend()
    {

    printf("Hello World!\n");
    CreateUDPSocket();

    for(int i=0;i<10000;i++)
    {
    sprintf(MyData.data,"%d",i);

    /**************************************/
    int j=SendData(MyData,sizeof(MyData));
    /**************************************/
    Sleep(1000);
    printf("ststus After sensing %d\n",j);
    }




    }

    /**************************************/
    #define EQ ==
    #define NEQ !=
    #define LEQ <=

    void CreateUDPSocket()
    {


    Sock=socket(AF_INET,SOCK_DGRAM,0);
    struct sockaddr_in name;
    int namelen;

    name.sin_family = AF_INET;
    name.sin_addr.s_addr = inet_addr(SRCIPADDR);
    name.sin_port = htons(SRCPORT);

    namelen=sizeof(name);
    bind(Sock,(struct sockaddr *)&name,namelen);




    }


    int SendData(struct DataToSend MyData1,int size)
    {
    static unsigned int PktCount=0;
    struct sockaddr_in name;
    int namelen;
    int status;

    name.sin_family = AF_INET;
    name.sin_addr.s_addr = inet_addr(DESTIPADDR);
    name.sin_port = htons(DESTPORT);
    namelen=sizeof(name);

    MyData1.PktNo=PktCount++;
    status=sendto(Sock,(char*)&MyData1,size,0,(struct sockaddr *)&name,namelen);
    return(status);
    }
    /**************************************/

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    What are your Windows firewall settings?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3
    i donot have any firewall activated in windows PC.


    infact , it is working with PCQLinux 2005,, but not with fedora

Posting Permissions

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