11-16-2012
If there's no newlines, how can you tell when the packet ends? Is it a fixed size? I suspect you're catching packets in the middle, and never finding the end properly.
For that matter, it's not all going to arrive at once, either. Serial data comes in serially if it's a serial port (is it, really? is it actually some USB device?)
Every 50 milliseconds is fast enough to not bother with timeouts, poll(), select(), or anything. Few things are going to be fine-grained enough to handle it, and there's enough buffers to confuse the matter. Just read() will do.
Last edited by Corona688; 11-16-2012 at 06:08 PM..
9 More Discussions You Might Find Interesting
1. Linux
Hi All,
I am a begineer in Linux, I have 4 ports and 3 are operational port 1,port 2 and port 4 (when I plug in serial device I can see it working) but port 3 seems it is not working.
I am sure the hardware is fine.
when I give command
dmesg | grep tty
I get,
serial 8250:ttyS0 at... (0 Replies)
Discussion started by: vr_82
0 Replies
2. SCO
dear sir,
pls. can you help me ? , my os is unix sco 5.0.4 and ,server dat derive (1,4gb)
not working, now i want to transfer my server data in other machine (unix/other possible) by serial port/other port comminication.
thanks
pankaj raval (2 Replies)
Discussion started by: pankajbraval
2 Replies
3. Programming
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)
Discussion started by: noppon_s
7 Replies
4. Shell Programming and Scripting
Hi,
I have a external board connected to my serial port. I need to execute "shutdown -r now" command when system boot up. When system boots up it requires a username ans password. Then I need to run my command. I can use rc script but that is rebooting system before it asks for username and... (0 Replies)
Discussion started by: charlie.arya
0 Replies
5. Solaris
Hi Everyone,
In my environment, I have few T5220. On the iLOM Management Card, I have both Network and Serial port are cabled, I don't have any issues while I try to connect using Network Management port, but when I try to connect the serial port for the same server which is actually connected... (3 Replies)
Discussion started by: bobby320
3 Replies
6. Programming
hey frns pls help me out !!
i hav a code of c that i have to include in my project.
i am using a device (geomeda) that has unix based OS. it also support SIM card for connecting to server . I need to send SMS to user from this device..
below code is not working .. i am unable to send sms and the... (7 Replies)
Discussion started by: yashwantkumar
7 Replies
7. Programming
Hi
I try to communicate with a GSM modem, from C, for sending SMS.
I use standart AT-commands.
Working well with terminal.
There is no problem writing ti the port.
But when I try to read I only get a echo, I write "ATI" and get "ATI" back, I should get somthing like "SIEMENS 35... (4 Replies)
Discussion started by: dmiller
4 Replies
8. Debian
Dear List -
I am trying to capture data from a serial port and write it to a file.
/var/www$ cat /dev/ttyS0 > scale_value.html
cat: /dev/ttyS0: Device or resource busy
/var/www# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:90... (11 Replies)
Discussion started by: Meow613
11 Replies
9. Solaris
Hello,
I have an unloaded T5140 machine and want to access the ILOM for the first time and subsequently the network port after that., and then load Solaris 10 the final January 2011 build.
The first part is what confuses me -the cabling.
I am coming from a Windows machine (w/appropriate... (5 Replies)
Discussion started by: joboy
5 Replies
LEARN ABOUT FREEBSD
pcap_get_selectable_fd
PCAP_GET_SELECTABLE_FD(3) Library Functions Manual PCAP_GET_SELECTABLE_FD(3)
NAME
pcap_get_selectable_fd - get a file descriptor on which a select() can be done for a live capture
SYNOPSIS
#include <pcap/pcap.h>
int pcap_get_selectable_fd(pcap_t *p);
DESCRIPTION
pcap_get_selectable_fd() returns, on UNIX, a file descriptor number for a file descriptor on which one can do a select() or poll() to wait
for it to be possible to read packets without blocking, if such a descriptor exists, or -1, if no such descriptor exists. Some network
devices opened with pcap_create() and pcap_activate(), or with pcap_open_live(), do not support select() or poll() (for example, regular
network devices on FreeBSD 4.3 and 4.4, and Endace DAG devices), so -1 is returned for those devices.
Note that in:
FreeBSD prior to FreeBSD 4.6;
NetBSD prior to NetBSD 3.0;
OpenBSD prior to OpenBSD 2.4;
Mac OS X prior to Mac OS X 10.7;
select() and poll() do not work correctly on BPF devices; pcap_get_selectable_fd() will return a file descriptor on most of those versions
(the exceptions being FreeBSD 4.3 and 4.4), but a simple select() or poll() will not indicate that the descriptor is readable until a full
buffer's worth of packets is received, even if the read timeout expires before then. To work around this, an application that uses
select() or poll() to wait for packets to arrive must put the pcap_t in non-blocking mode, and must arrange that the select() or poll()
have a timeout less than or equal to the read timeout, and must try to read packets after that timeout expires, regardless of whether
select() or poll() indicated that the file descriptor for the pcap_t is ready to be read or not. (That workaround will not work in FreeBSD
4.3 and later; however, in FreeBSD 4.6 and later, select() and poll() work correctly on BPF devices, so the workaround isn't necessary,
although it does no harm.)
Note also that poll() doesn't work on character special files, including BPF devices, in Mac OS X 10.4 and 10.5, so, while select() can be
used on the descriptor returned by pcap_get_selectable_fd(), poll() cannot be used on it those versions of Mac OS X. Kqueues also don't
work on that descriptor. poll(), but not kqueues, work on that descriptor in Mac OS X releases prior to 10.4; poll() and kqueues work on
that descriptor in Mac OS X 10.6 and later.
pcap_get_selectable_fd() is not available on Windows.
RETURN VALUE
A selectable file descriptor is returned if one exists; otherwise, -1 is returned.
SEE ALSO
pcap(3), select(2), poll(2)
22 July 2011 PCAP_GET_SELECTABLE_FD(3)