Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UDP communication between C++ and Java does not work

 
M
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

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
 
Karen Baog
Ranch Hand
Posts: 120
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm also interested on this.
I'm new to UDP, but my task is similar to this.

I've posted a thread on UDP in the beginner's forum:

UDP

I will need to write an application in Java, which will communicate to 2 other applications (already) written in C++. My Java application basically "sits" between these 2 application, translating messages coming from one machine and forwarding it to the other machine.

I hope someone would provide an answer, and also to my question in the above link.

Thanks to all.

Karen
 
Willie McGee
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the actual error you get?
 
Damaso Lopez
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Willie McGee wrote:what is the actual error you get?


I've same problem,my case it send a buffer 1024 bytes in Java for UDP and received I've supposed 1024 in C but this application "C" says "Error UDP frame too smaill: 1024" I don't know that to do bad. My code is:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic