This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

Peter Aarestad

Greenhorn
+ Follow
since Apr 11, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Aarestad

Originally posted by Ernest Friedman-Hill:
Hi Peter,

Well, if you're going to use readUTF(), then the C program has to write UTF data. The definition for the format is here; look for the part about the readUTF() method. It's unfortunately much more complex than just sending the characters!



I found that just before I came back to this forum. Basically, it's not so bad for plain old ASCII - I coded up a general-purpose function in C that emulates Java's protocol, and it looks like it works pretty well. Thanks for your help!
Let me chime in here, since I am trying to figure out how to do the same thing. On the server (Java) side, here's my simple code:



On the C side, I am simply doing :



However, when I run the C client after having started the Java server, this is what I see:


What should I be doing differently here? Anyone else try to do this before? I tried removed the "+ 1" from the third argument of send() since Java strings are not null-delimited, but I still got the EOFException. The C program exits normally (I'm checking the return code from send()), so I know the client is sending the data. Thanks!