This is a discussion on RE: Trying to get started with TCPIP programming - VMS ; > -----Original Message----- > From: tadamsmar [mailto:email@example.com] > Sent: Tuesday, May 06, 2008 7:13 PM > To: Info-VAX@Mvb.Saic.Com > Subject: Re: Trying to get started with TCPIP programming > > On May 6, 5:26*pm, Jan-Erik Söderholm > wrote: > > ...
> -----Original Message-----
> From: tadamsmar [mailto:firstname.lastname@example.org]
> Sent: Tuesday, May 06, 2008 7:13 PM
> To: Info-VAX@Mvb.Saic.Com
> Subject: Re: Trying to get started with TCPIP programming
> On May 6, 5:26*pm, Jan-Erik Söderholm
> > tadamsmar wrote:
> > > We have gas analyzers that are interfaced via serial lines. *The
> > > analyzers have the capability of communicating over
> ethernet using
> > > the same ascii protocol as for serial.
> > > I have the task of converting from serial to ethernet. *
But I don't
> > > know the first thing about TCPIP programming.
> > > I am looking at tcpip$examples. *I am using VMS 7.3.2.
> > > tcpip$udp_server_qio.c
> > > tcpip$udp_client_qio.c
> > > client_qio writes and server_qio reads.
> > > I could modify client to write a command to the analyzer.
> > > But I am not sure how to read back the response from the analyzer?
> > > Or could I use:
> > > tcpip$udp_server_sock.c
> > > tcpip$udp_client_sock.c
> > > I could modify client_sock to send and recieve from the
> analyzer, I
> > > guess.
> > > The analyzer uses port 9880.
> > > I am not sure how to send and recieve in the same
> program. *None of
> > > the examples both send and recieve a message.
> > I've looked at the same "problem" lately.
> > Replacing serial connected PLC's (through term-servers using TNS
> > devices) with direct ethernet.
> > I thought the examples (and the socket API programming
> > manual) had good examples. As soon as you have an open
> socket you can
> > read and write over it as you please.
> > The main difference between the "client" examples and the "server"
> > examples, is which end initiates the connection.
> > As sson as the socket is there, there is not that much differences.
> > Anyway, we decided to continue to use term-servers and
> > RS232 connected PLC's for the time beeing...
> > Jan-Erik.- Hide quoted text -
> > - Show quoted text -
> So, I guess the analyzer that I am trying to connect to has
> already initiated the socket, so it's like the server? It
> appears that the analyzer is just setting there ready to
> respond to commands sent to 9880.
Sort of - typically the device socket "listens" on a specific TCP port number
(9880) for a connect request from the application. You have to set up the socket
on your end to use that port number and "connect" it to the "listening" socket
on the device end. The client example should have all of that code in it. When
your connect completes the two sockets have formed a TCP connection and you can
read/write it like any byte stream. Be careful on the reads - socket reads block
until ALL of the data you requested is received. If you don't know how many
bytes are coming you have to either read them one at a time or set up some type
of timer to complete the read. Again the example should show that procedure.