From: John Stone (
Date: Wed May 28 2003 - 14:36:42 CDT

  All the vmdsock_selread() function does is wait until there's
something available for reading on the socket. Note that the NAMD
code has two modes of operation: a blocking mode where it loops
waiting for an IMD connection, and a polling mode where it just
does a quick test to see if an IMD connection came in since the
last check, see GlobalMasterIMD::calculate() in the NAMD source.

>From there, if there was an incoming socket, it does a call to
vmdsock_accept(), then my_imd_connect() which does the necessary
handshaking process by calling imd_handshake().

Does that make sense?
What error are you getting during vmdsock_selread()???
What's the return code and/or errno set to in your program?

What system are you running this code on?

  John Stone

On Wed, May 28, 2003 at 09:21:19PM +0200, Marc Baaden wrote:
> >>> John Stone said:
> >> When the connection first occurs, endianness is determined by
> >> the byte order of integers that come early in 'handshake' process.
> >> Check out the IMDSim::handshake() code in VMD. The server (NAMD, Protomol,
> >> or your program) should be sending an integer '1', VMD listens for this
> >> and from this message determines the endianism of the remote host.
> Yes, I found this routine and its definition. But what I don't understand is
> where the integer '1' is sent (which routine).
> Because from my understanding of the NAMD code it schematically does
> things in the following order
> vmdsock_create();
> vmdsock_bind(sock, port);
> vmdsock_listen(sock);
> vmdsock_selread(sock, 3600); <== here my error occurs
> vmdsock_accept(sock);
> imd_handshake(sock); <== '1' is exchanged here, no ?
> [..]
> The selread subroutine however does not seem to send the 1 signal for
> determining endianness, but debugging shows me that it is exactly at
> this point (at rc = select(s->sd+1, &rfd, NULL, NULL, &tv); to be exact)
> that VMD produces the endianness error.
> I'll keep on searching ..
> >> Regarding licensing: the standard VMD/NAMD licenses allow up to 10% of the
> >> non-comment source code lines to be re-used, so that should easily cover
> >> all of the IMD files you're interested in.
> Yes indeed. That is great news.
> Thanks,
> Marc
> --
> Dr. Marc Baaden - Institut de Biologie Physico-Chimique, Paris
> -
> FAX: +49 697912 39550 - Tel: +33 15841 5176 ou +33 609 843217

NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email:                 Phone: 217-244-3349              
  WWW:      Fax: 217-244-6078