The cursor blinks as the read didn't stop as it didn't receive a <newline> char. I guess your device sends <carriage return>s? Try
For testing, you might want to experiment with other read options:
Quote:
-n nchars
read returns after reading nchars characters rather than waiting for a complete line of input, but honor a delimiter if fewer than nchars characters are
read before the delimiter.
-N nchars
read returns after reading exactly nchars characters rather than waiting for a complete line of input, unless EOF is encountered or read times out.
.
.
.
-t timeout
Cause read to time out and return failure if a complete line of input (or a specified number of characters) is not read within timeout seconds. timeout
may be a decimal number with a fractional portion following the decimal point.
hi. Im trying to install a switch.
And the manual says i should type a command including a SerialPortDevicePath. which is the filepath to serial port used for connection.
However.. nothing about how to find this info.
Could anyone help me where to find this path?
thx
mr.T (6 Replies)
Hey!
I'm trying to figure out a sollution for a problem I have at my company with an Iomega MiniMax 500 GB USB disk.
If i run cat /proc/bus/usb/devices
I get this information:
T: Bus=01 Lev=02 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00... (2 Replies)
Hello!
I am working on an application which reads environmental instruments which have serial ports. The application requires a serial port to be present to talk to the device (i.e. /dev/ttyS0 ). In some instances the environmental devices will be 100's of yards away from the computer, so a... (5 Replies)
I have problem with C programming. I want to send & receive data through serial communication. I send data(command) to device to get data from device but when receive data, it can't get altogether of data.
It get only some data. What should I do to get altogether of data?
If all of... (7 Replies)
I am using the while-loop to read a file.
The file has lines with null-terminated strings (words, actually.)
What I have by that reading - just a first word up to '\0'!
I need to have whole string up to 'new line' - (LF, 10#10, 16#A)
What I am doing wrong?
#make file 'grb' with... (6 Replies)
I am trying to change one of my serial printers from /dev/ttyr002 to /dev/ttyr014:
lpstat -s
device for check3: /dev/ttyr002
device for check4: /dev/ttyr002
I changed the tty setting for check3 in:
/etc/printcap
/var/spool/lp/admins/lp/printers/check3
to /dev/ttyr014
Then I get:... (4 Replies)
I have a script batch_vmdgenpqr.sh which has a problem:
#!/bin/bash
while read line
do
vmd.sh -dispdev text -e vmdgenpqr.tcl -args $line
done<file
The do line calls another program, VMD (called by vmd.sh) and it requires the values from $line, but this is not recognised by... (3 Replies)
Hi All,
Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool.
Wraper script am trying is to do with above metion 2 files.
utility tool accepts :
a. userinfo file : which contains username
b. item file : which... (2 Replies)
Heyas
I'm trying to read/display a file its content and put borders around it (tui-cat / tui-cat -t(ypwriter).
The typewriter-part is a 'bonus' but still has its own flaws, but thats for later.
So in some way, i'm trying to rewrite cat using bash and other commands.
But sadly it fails on... (2 Replies)
Hello,
I'm works on Ubuntu server
My goal : I would like to read file line per line, but i want to started at the end of file.
Currently, I use instructions :
while read line;
do
COMMAND
done < /var/log/apache2/access.log
But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies
LEARN ABOUT NETBSD
pcap_next_ex
PCAP_NEXT_EX(3) Library Functions Manual PCAP_NEXT_EX(3)NAME
pcap_next_ex, pcap_next - read the next packet from a pcap_t
SYNOPSIS
#include <pcap/pcap.h>
int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header,
const u_char **pkt_data);
const u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h);
DESCRIPTION
pcap_next_ex() reads the next packet and returns a success/failure indication. If the packet was read without problems, the pointer
pointed to by the pkt_header argument is set to point to the pcap_pkthdr struct for the packet, and the pointer pointed to by the pkt_data
argument is set to point to the data in the packet.
pcap_next() reads the next packet (by calling pcap_dispatch() with a cnt of 1) and returns a u_char pointer to the data in that packet.
The pcap_pkthdr structure pointed to by h is filled in with the appropriate values for the packet.
RETURN VALUE
pcap_next_ex() returns 1 if the packet was read without problems, 0 if packets are being read from a live capture, and the timeout expired,
-1 if an error occurred while reading the packet, and -2 if packets are being read from a ``savefile'', and there are no more packets to
read from the savefile. If -1 is returned, pcap_geterr() or pcap_perror() may be called with p as an argument to fetch or display the
error text.
pcap_next() returns a pointer to the packet data on success, and returns NULL if an error occured, or if no packets were read from a live
capture (if, for example, they were discarded because they didn't pass the packet filter, or if, on platforms that support a read timeout
that starts before any packets arrive, the timeout expires before any packets arrive, or if the file descriptor for the capture device is
in non-blocking mode and no packets were available to be read), or if no more packets are available in a ``savefile.'' Unfortunately,
there is no way to determine whether an error occured or not.
SEE ALSO pcap(3), pcap_geterr(3), pcap_dispatch(3)
5 April 2008 PCAP_NEXT_EX(3)