[Gmsh] feature request: gmsh reads input from TCP port

Al Danial al.danial at gmail.com
Tue Mar 14 06:53:28 CET 2006


> > On the Linux side once again I did "cat cone.geo | nc 192.168.1.103 44122"
> > and this caused gmsh on Windows to crash.  I figured I'd better go
>
> It shouldn't crash, but it's normal that it doesn't work: you cannot
> just send data on the socket--you have to follow Gmsh's solver protocol.
> (That's what GmshClient.h is there for. Basically, the data is sent with
> headers explaining the nature of what is sent next.)

OK, that explains a lot.

My naive view of a solution to accepting inputs over TCP was more along
the lines of how gmsh currenlty reads commands from a file.  The gmsh
file reader must do something like this:

  open the file
  while not end-of-file {
    read a line of input
    process the line
  }
  close the file

A TCP reader could work the same way as the file reader:

  open the socket
  while not disconnected {
    read a line of input
    process the line
  }
  close the socket

As long as the data coming over the socket looks line lines of text
there should be no difference between file input and socket input.
Of course pseudocode is easy to rattle off and I'm probably overlooking
complicating factors.

> > I then tried the "cat cone.geo | nc ..." again but this time gmsh just
> > ignored it.  The gmsh message window said
> >     Warning : Failed to receive body on socket: aborting
> >     Info    : Client disconnected: starting new connection
>
> That's pretty good actually: it means that it received a header
> (probably just lucky to get a number that is in the protocol), but
> didn't get the associated data.
>
> >
> > For some reason I was initially able to send something between Linux
> > and gmsh on Windows but it isn't repeatable; all subsequent attempts
> > failed.   Next I will try going from Windows to Linux, will post my
> > findings.   -- Al
> >
>
> Sounds good. I've only had a chance to test all this stuff on "single"
> machines, so your tests will be useful.

Naturally the Windows to Linux method failed too as I tried the same
trick of sending the contents of a geo file through a socket without
specifying any protocol.            -- Al