08-06-2007
how to use select() function for 32 com ports
Quote:
Originally Posted by
porter
One technique is to use a thread to read and a thread to write, however what consider what is the purpose of a thread to write when it will be idle 99% of the time. You could have a thread per port which still uses a select().
Personally I would do the single select statement and no threads as this is the most portable solution, select() will tell you when each port needs to be read, and you would manage your own buffers. You would hook in a select() for the write mask only when you have data queued to write out.
Dear Sir thx very much for replying me.
can u help me how i can write single select function for all 32 com ports.
i mean if i have single thread and i m use select() for all 32 com port then how i write select function to watch multiple fds.
Regards,
Amit
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I want to write a server application that would accept HTTP requests from client.
The server would be on a machine that has no connection to the INTERNET.
The clients that would be posting their HTTP requests would be doing so through webbrowser .Thus it would be sort of intranet application.... (0 Replies)
Discussion started by: rraajjiibb
0 Replies
2. IP Networking
Hello Mentors!
I am a new here in the furom, i hope somebody can understand my problem.
Basically we have an application here called unigraphics and being installed per station and the setup is look like this.
1. installed unigraphics UGNX3 version on every station
2. some are installed in... (1 Reply)
Discussion started by: eykyn17
1 Replies
3. UNIX for Dummies Questions & Answers
Hello
im using sunos im trying to lock down application that taking my port
when Im doing "netstat -in | grep 8080"
Is gives me the indication that the port is taken but no indication who is taken the port.
How can I find out who is taking my port?
Thanks allot (7 Replies)
Discussion started by: umen
7 Replies
4. Linux
Hi All,
I have two MQ (port) 1414 established (going out)
$ netstat -an | grep 1414
tcp 0 0 0.0.0.0:1414 0.0.0.0:* LISTEN
tcp 0 0 20.76.1.1:32855 142.8.1.3:1414 ESTABLISHED
tcp 0 0... (2 Replies)
Discussion started by: itik
2 Replies
5. Shell Programming and Scripting
Hi,
is there any command to findout that which application is using the particular port.
or whether any port is occupied with the specfic process id ? (4 Replies)
Discussion started by: mail2sant
4 Replies
6. Programming
Hi ,
I need some help as I dont know where to start. I need to create a unix decryption application.
The information I have been given is this so far:
the specification of the encryption process is:
NET 2 Cryptography classes.
RijndaelManaged encryption algorithm
... (13 Replies)
Discussion started by: caciing_help
13 Replies
7. 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
8. HP-UX
Hi,
I have an application running on HP-UX, from this application I need to findout if the port number. lets say 7890,7891, 7892 are listening on the remote server running on HP-UX.
Is there any way of doing it using "system()" function or any other?
I noticed that nmap, netcat are not... (0 Replies)
Discussion started by: einsteinBrain
0 Replies
9. UNIX for Advanced & Expert Users
Hi all,
I have a code to create folder in application server through shell script and i want to create if conditional based folder
folder=$HOME/test/sample/whatever
if ; then
echo "$folder already exists, not created."
else
mkdir -p "$folder" > /dev/null 2>&1
... (7 Replies)
Discussion started by: Boost
7 Replies
10. Shell Programming and Scripting
Hi Expert,
Anybody can figure it out on how to generate new port base on my last port let say my last port var1=124 and increment for new port 125,126 but this new two ports need to look at first if this port is not in used by any service, if the port is in used add 1 to new port and if in used... (6 Replies)
Discussion started by: lxdorney
6 Replies
LEARN ABOUT HPUX
pthread_rwlock_rdlock
pthread_rwlock_rdlock(3T) pthread_rwlock_rdlock(3T)
NAME
pthread_rwlock_rdlock(), pthread_rwlock_tryrdlock() - lock or attempt to lock a read-write lock for reading
SYNOPSIS
PARAMETERS
rwlock Pointer to the read-write lock to be locked for reading.
DESCRIPTION
The function applies a read lock to the read-write lock object referenced by rwlock. The calling thread shall acquire a read lock if a
writer does not hold the lock and there are no writers blocked on the lock. It is unspecified whether the calling thread acquires the lock
when a writer does not hold the lock and there are writers waiting for the lock. If a writer holds the lock, the calling thread shall not
acquire the read lock. If the read lock is not acquired, the calling thread blocks (that is, it does not return from the call) until it
can acquire the lock. Results are undefined if the calling thread currently owns a write lock on rwlock.
Implementations shall be allowed to favor writers over readers to avoid writer starvation.
A thread may hold multiple concurrent locks on rwlock (that is, successfully call the function n times). If so, the thread must perform the
matching unlocks (that is, it must call the function n times).
The function applies a read lock as in the function with the exception that the function fails if any thread holds a write lock on rwlock
or there are writers blocked on rwlock.
Results are undefined if any of these functions are called with an uninitialized read-write lock.
If a signal is delivered to a thread waiting for a read-write lock, upon return from the signal handler, the thread shall resume waiting
for the read-write lock as if it was not interrupted.
RETURN VALUE
Upon successful completion, and return zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding error number:
[EBUSY] The read-write lock rwlock could not be acquired for reading because a writer holds the lock or was blocked on it.
For each of the following conditions, if the condition is detected, the and functions return the corresponding error number:
[EINVAL] The value specified by rwlock does not refer to an initialized read-write lock.
[EDEADLK] The current thread already owns the read-write lock for writing.
[EAGAIN] The read lock could not be acquired because the maximum number of read locks for rwlock has been exceeded. This error
is not detected on HP-UX.
AUTHOR
and were developed by X/Open.
SEE ALSO
pthread_rwlock_init(3T), pthread_rwlock_destroy(3T), pthread_rwlock_trywrlock(3T), pthread_rwlock_wrlock(3T), pthread_rwlock_unlock(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_rwlock_rdlock(3T)