Xref: utzoo comp.lang.c:38411 comp.unix.programmer:1607 comp.unix.questions:30518 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!helios!carnivore.tamu.edu From: greg@carnivore.tamu.edu (Greg Economides) Newsgroups: comp.lang.c,comp.unix.programmer,comp.unix.questions Subject: Sending struct through DGRAM socket Message-ID: <14918@helios.TAMU.EDU> Date: 18 Apr 91 15:35:05 GMT Sender: usenet@helios.TAMU.EDU Followup-To: comp.lang.c Distribution: na Organization: Biosystems Modelling Group, Texas A&M University Lines: 22 I am trying to communicate with a forked process using a DGRAM socket (AF_UNIX) on a Sun 386i (OS 4.0.2). What I really want to send through the socket is a small struct (about five float fields). I have been using the `sendto' and `read' functions which need a (char *) to send through the socket. These work fine with character strings, but do not do so well with structs. Is there a quick/clean way to translate a struct into a character stream (and then a way to get the struct back) so that it can be sent using these functions? Is there a better or more straight-forward way of doing this? I am still quite a fledgling sockets programmer. Thanks for any and all help. I will summarize the responses if there is interest. Peace, -- Greg Economides "This sentence is false" Technical Lab Coordinator Texas A&M University -- Biosystems Modelling Group Internet: greg@carnivore.tamu.edu