Java and C++ do not talk over UDP


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Java and C++ do not talk over UDP

  1. #1
    Join Date
    Jul 2005
    Location
    Berlin/Germany
    Posts
    2

    Java and C++ do not talk over UDP

    Hi folks.

    Currently I'm stuck on a very simple UDP communication protocol between a Windows MFC (VC++) application and a Java application.

    I have a Java Server and a Java Client .. they communicate perfectly with each other.

    The same on the C++ Side. Client and Server talk for hours with each other about lots of nonsense. ( currently about the meaning of life and 42 I think ;-) )

    Only when I try to let any java program communicate with it's c++ counterpart - it fails !

    Are there any additional "feature" I have to consider? (Except firewall and wrong ports?)

    Here some more Details:

    C++ part:

    I tried Winsock as well as WinSock2.

    with WSAStartup(..)
    and socket(AF_INET, SOCK_DGRAM, 0);

    Java part:

    something with...

    socket.connect(address, DAYTIMEPORT );
    byte[] buf = new byte[DGRAM_BUF_LEN];
    DatagramPacket packet = new DatagramPacket(buf, buf.length );
    socket.send(packet);
    socket.receive(packet);

    Can anybody help me out?

    Marco

  2. #2
    Join Date
    Dec 2003
    Location
    tx/us
    Posts
    131
    Just to clarify. These client/server pairs are doing exactly the same (possibly meaningless) thing but doing it just fine as long as it's within the same platform. If you swap either the client or the server for it's other language doppleganger then the conversation stops happening. Right?

  3. #3
    Join Date
    Jul 2005
    Location
    Berlin/Germany
    Posts
    2
    Yes.
    I reduced the problem to small demo programs. Both are running on windows and you are right .. as long as java talks to java everything is fine .. and c++ to c++ as well. But talkting to each other .. no packages are exchanged.

    Very strange ...

  4. #4
    Join Date
    Dec 2003
    Location
    tx/us
    Posts
    131
    That is odd. I'm buffaloed. Have you tried them with TCP instead if UDP? Wow, there should be no architectural dependencies on the two ends of a network conversation.

  5. #5
    Join Date
    Jul 2005
    Posts
    9
    Are you testing this on one machine, or on two over the network?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center