AnsweredAssumed Answered

vrf Socket Communications

Question asked by VRFuser on May 2, 2002

I am assuming that you do not have VEE on the Unix box.
I have not done this with VEE, but I have been involved in a project that
used sockets in C and Java.  In general, I'd say that using a socket
with Java is pretty straight forward, and quite portable.  We
implemented the same socket protocol in C and Java, and the java code
was a wee bit simpler on Unix, and it was too painful to do the same
sorts of things with the windows API in C.

Here is my generic comment, since I can't hand you a code example.
The trick to doing these sorts of things is to define a simple
protocol for the info going through the socket.  Doesn't matter if it
is VEE, C or Java.  My personal favorite is to send "packets" which
consist of some set of header bytes, then a batch of 0 or more info
bytes.  Off the top of my head, a packet may look like:

int16   Packet #,
int16   operation code,
int16   bytes of info,
int16   check sum
bytes[] array of info

Then you can listen for the full header, look at it, then listen for
the byte array.  Put time outs on stuff, and you can recover from
errors.  Build the app in layers, so that you have functions that
build and ship packets, corresponding functions that recieve and
unpack packets, and separate functions that carry out the stuff for
each opcode and understand what is supposed to be in that array of
bytes.  For your app, you might define 100 to be the opcode for
"whatrev" and 101 to be reply to what rev.  The byte array might be
the string for the name of the app for code 100, and the bytes are the
string for the version for 101.  The packet number is used to keep
track of things.  For instance a reply has the same packet number as
the original request.  Each side can try to ensure consecutive packet
numbers, but it isn't always needed.  If there can be multiple
requests outstanding, the packet number can be used to send replies to
the correct place.  If things are more single minded, it is easier.

Got the idea?  The trick here is to do a good full design, then
implementing and debugging is straight forward.


> Hello all,
> what I'm trying to do is communicate from a PC to a UNIX box via a socket
> connection.  I would like the PC to execute a command on the UNIX system and
> retreive the result via a socket connection.  For example there is a command
> 'whatRev' that will display the revision of some application code. I would
> like to get this result back to the VEE program.  Has anyone done this
> already ??  I'm not sure, but I think I might have to create a socket port
> on the UNIX side, as I'm not sure I'm looking for some help.
> Thanks, for any comments or input..
> Pete Thomas
> Test Engineer - GE Medical System
This is the "vrf" maillist, managed by Majordomo.  To send messages to
this maillist, just email to "".  Subscriptions and
unsubscriptions are done through the address "".
If you need details, just send a message containing the text "help"
to "".