Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Nov : C Struct thru the socket?

www.cryer.info
Managed Newsgroup Archive

C Struct thru the socket?

Subject:C Struct thru the socket?
Posted by:"Clay Shannon" (blac..@redgreen.com)
Date:Wed, 1 Nov 2006 18:14:52

How can I receive a C struct via a socket connection and unpack it into its
component parts?


The RealTime system will send C structs like this:

OpCode Int
{ and a bunch of other vals, some Int, some Char }


By reading OpCode, I'll know the number and data type of the rest of the
values in that particular record (if it is 4, it will contain 3 integers, if
it's 42, it will be 4 Ints and 2 Strings, etc.).


But what code do I need to write to first extract just the OpCode?


I'm using BDS2006 and the deprecated TClientSocket and TServerSocket
components for socket communication between my Win32 app and the RealTime
system running on Linux.

--
Download my historical nonfiction and/or satirical (etc.) fiction books free
from here:
http://www.lulu.com/blackbirdcraven

Replies:

www.cryer.info
Managed Newsgroup Archive