Sending an int from Java to C using sockets

Posted by David Morris on Stack Overflow See other posts from Stack Overflow or by David Morris
Published on 2010-03-15T23:57:26Z Indexed on 2010/03/15 23:59 UTC
Read the original article Hit count: 147

Filed under:
|
|
|

I was just wondering how to send an int from a Java application to a C application using sockets. I have got different C programs communicating with each other and have got the Java application retrieving data from the C application, but I can't work out sending.

The C application is acting as database, the Java application then sends a user id (a 4 digit number) to the C application, if it exists it returns that record's details.

In Java I have tried using a printWriter and DataOutputStream to send the data, printWriter produces weird symbols and DataOutputStream produces "prof_agent.so".

Any help would be appreciated as I don't have a good grasp of sockets at the moment.

© Stack Overflow or respective owner

Related posts about c

    Related posts about java