Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!bryant!glenn From: glenn@bryant.NCD.COM (Glenn Shapland) Newsgroups: comp.windows.x Subject: Re: XTerminals and bar-code readers Message-ID: <4835@lupine.NCD.COM> Date: 4 Apr 91 16:23:46 GMT References: <1556502476@corona.med.utah.edu> <1991Apr3.144425.12207@exloghou.portal.com> Sender: news@NCD.COM Reply-To: glenn@bryant.NCD.COM (Glenn Shapland) Lines: 73 In article <1991Apr3.144425.12207@exloghou.portal.com>, dave@exloghou.portal.com (Dave St.Clair) writes: |> > Can anyone verify whether or not a bar code wand can be stuck on an |> > XTerminal (NCD. DEC). They are typically inserted inline on char. |> > based terminals and pcs. |> |> We use NCD 17/14c Xterminals in our application and hook |> the serial port to a variety of devices. |> The port is easily accessed via a socket from a host machine |> (I think its number is 87). Once you've connected to the socket |> you can do whatever you like. |> |> Here's a portion of the code which opens the socket (On a Sun |> Sparc 2 running SunOS 4.1.1, NCD 17c software version 2.2.2D) |> ... |> |> #include |> #include |> #include |> #include |> #include |> |> |> #define NCDPORTNUM 87 |> .... |> |> fd = xserial(NCDPORTNUM, ncdname); |> ...... |> |> int xserial(int portnum, char *hostname) |> { |> struct sockaddr_in sin; = { AF_INET }; |> struct hostent *host; |> |> sin.sin_port = htons((u_short)(portnum)); |> |> sin.sin_family = AF_INET; |> if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) |> return(FAILURE); |> |> if((host = gethostbyname(hostname)) == (struct hostent *)0) |> return(FAILURE); |> |> sin.sin_family = host->h_addrtype; |> bcopy(host->h_addr, (caddr_t)&sin.sin_addr, host->h_length); |> |> if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) |> { |> close(s); |> return(FAILURE); |> } |> |> (void)fcntl(s, F_SETFL,O_NDELAY); /* set to non-blocking */ |> |> return(s); |> } |> |> |> |> Dave St.Clair |> dave@exloghou.portal.com Here at NCD we use a bar code reader wedge that is connected between the keyboard and the base. In this case the bar code reader looks just like keyboard input. The bar code reader we use is from BTC and was made for IBM PC/PS2 compatibles. The nice thing about this setup is that it leaves the serial port free for other uses. In our application we use the serial port to run a printer for printing bar code labels. Glenn Shapland glenn@ncd.com