Original Post
Hi guys, I was wondering if anyone could give me some advice on a little problem I am having.
I am writing a simple client\server based file sharing program. Now for reasons that you really dont have to know, the client is in Java and the server is C.
The server was written by me some time ago and uses sockets to comminicate. It works by sending structs down the network and the old C client just casted them back to structs when it received the data.
This worked fine, but as the old client was a commandline based program. I decided to update it as a Java app (dont ask why I am not using a c gui api please)
Now I am rather a noob when it comes to sockets in Java but I managed to get the client talking to the server just sending strings. But when it comes to sending the structs down the network my Java client goes insane.
I know the socket api is just sending a stream of bits down the network but is there an easy way of getting the data out of this like i could do with just casting in the old C client. Or am I going to have to read it bit by bit?
For reference the data struct looks like this:
struct s_MessageStruct {
unsigned int messageID;
unsigned int messageDataLength;
char messageData[500];
};