Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!convex!iex!ntvax!doug From: doug@ntvax.uucp (Douglas Scott) Newsgroups: comp.windows.x Subject: Storing data structure as a property Summary: What am I doing wrong? Keywords: properties, XChangeProperty, selections Message-ID: <1989Nov29.072922.18738@ntvax.uucp> Date: 29 Nov 89 07:29:22 GMT Sender: Douglas Scott Reply-To: doug@dept.csci.unt.edu (Douglas Scott) Organization: CEMI, University of North Texas Lines: 54 I have an application in which I wish to transfer a structure containing some data between two instances of the same application, using the Selection mechanism. It is a small structure containing the name and size of a temporary file (created by the requestee) wthat will be read by the requestor. Since none of the standard format types or Atoms match what I am doing, I figured I would just treat the struct as if it were just a string of raw chars (as far as the property was concerned) and then recast it after it is retrieved by the requestor: store_selection(event) /* loads selected region into cut buffer & property */ XSelectionRequestEvent *event; { ... ext_buff ext_info; /* the struct with name & size of buffer */ ...in here the temp file is created, opened, written to, and closed in preparation for use by the requestor ... /* set up the information struct to pass to requestor */ strcpy(ext_info.name, bufname); ext_info.bufsize = c->bufsize; XChangeProperty(dpy, /* load into property */ event->requestor, /* these are ok */ event->property, event->target, format, /* set to 8 */ PropModeReplace, (char *) &ext_info, /* cast as char array */ (int) sizeof(ext_buff)); /* no. of bytes in struct */ ...and so forth -- but as soon as XChangeProperty is called, I get: XIO: fatal IO error 32 (Broken pipe) on X server "woof:0.0" after 1388 requests (1388 known processed) with 0 events remaining. The connection was probably broken by a server shutdown or KillClient. Is there a better way to send this data structure than as a char array? Is there a format or size problem here? Am I trying to do something illegal, and if so, why cant you send arbitrary chunks of data as chars and recast on the other side? I have my own Atom type for this that I create with XInternAtom, so I am sure to send and recieve something that both sides recognize. Thank you in advance! ---------------------------------------------------------------------- Douglas Scott Research Associate, CEMI, University of North Texas doug@dept.csci.unt.edu