12-19-2010
Quote:
Originally Posted by
Loic Domaigne
Hi,
The answer from fpmurphy is short, but up to the point. Let me explain a little bit; In a multi-threaded process, a signal handler process-wide, that is global to all threads. However, when the signal is delivered, the system library / kernel picks up a particular thread that shall run the handler. This might be any thread in the process.
In your particular example, you wish that the handler runs in the context of thread1, so that the recvfrom() gets interrupted. But, unless you force it too, the handler may run in the context of the main thread. In that case, nothing will happen. This is likely what you are experiencing.
The way to force the handler to run in the context of thread1 (or equivalently, we say the signal to be delivered to thread1) is using pthread_sigmask() as mentioned by fpmurphy. Please refer to example in the link provided above, to see how it works. Incidentally, this example was my first contribution to the SUSv3 standard; so if you have questions please feel free to ask
And finally, I would suggest to resort other strategies than alarm() & co. to implement a timeout on the receive operation if you're multi-threaded.
Cheers, Loïc.
Thanks, I will try it today.
9 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
I am unable to open the mimesender thread. I get the following message when clicking on https://www.unix.com/showthread.php?p=33233#post33233 : (2 Replies)
Discussion started by: dangral
2 Replies
2. IP Networking
Hi
I want a UDP client receiving program. Here is the scenario. The client has to listen to the UDP server and has to acknowledge back on receiving data from the server. Can anyone help me out.
regards,
Nirmala (1 Reply)
Discussion started by: Nirmala
1 Replies
3. Programming
Hi,
Am very new to socket programming.
When we use UDP sockets to communicate between two processess,
will both the client/server socket be able to send/recv ?
meaning can sendto()/ recvfrom() be used on both server and client?
It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies
4. UNIX for Advanced & Expert Users
HI
I want to create a UDP concurrent server
can any one give the code for UDP concurrent server (8 Replies)
Discussion started by: chanikya
8 Replies
5. Forum Support Area for Unregistered Users & Account Problems
Hello,
I'd like to post a aix thread but I'm unable to.
Please let me know why this is happening.
Thanks.... (1 Reply)
Discussion started by: sullivjp
1 Replies
6. Programming
Hi,
I have a situation where i need to communicate a linux client with a windows server, I am using a UDP socket communication channel. I am able to send packets from my linux clients to the windows server but unable to receive any data packet from the server. Do i need to make any setting in... (0 Replies)
Discussion started by: John20
0 Replies
7. IP Networking
Hifriends
I have a doubt .
how to create a multi-chat server using UDP which can run on MAC systems..
Thank u in advance (3 Replies)
Discussion started by: babbu25
3 Replies
8. Forum Support Area for Unregistered Users & Account Problems
I am unable to post reply to a thread. Whenever I will reply to any post I get the message every time :
The message you have entered is too short. Please lengthen your message to at least 5 characters.
Even though length of the message is more than required.
for example I tried to post
... (3 Replies)
Discussion started by: Unregistered
3 Replies
9. Forum Support Area for Unregistered Users & Account Problems
Hi.
I registered, but when trying to post, I get ...
"Sorry, you do not have enough Bits to post a new thread"
Google & Forum search showed some hits, but no solution.
Please advide.
Thanks! (1 Reply)
Discussion started by: gehe
1 Replies
LEARN ABOUT DEBIAN
jack.udp
JACK.UDP(1) JACK.UDP(1)
NAME
jack.udp - JACK UDP Transport Client
SYNOPSIS
jack.udp [options] send|recv
OPTIONS
-b : Set the ring buffer size in frames (default=4096). -c : Set the client name (default=jack.udp-PID). -n : Set the number of channels,
and therefore the number of JACK ports (default=2). -p : Set the port number (default=57160). -r : The remote host name, for use in send
mode (default="127.0.0.1").
DESCRIPTION
jack.udp is a UDP audio transport mechansim for JACK. The send mode reads signals from a set of JACK input ports and sends UDP packets to
the indicated port at the indicated host at a rate determined by the local JACK daemon. The recv mode reads incoming packets at the indi-
cated port and writes the incoming data to a set of JACK output ports at a rate that is determined by the local JACK daemon.
This transport mechanism is unreliable. Both send and recv clients will report buffer overflow and underflow occurences, and recv clients
will report dropped and out-of-order packets, and shutdown on channel mismatch packets. In practice this mechanism can be made highly reli-
able over local networks.
jack.udp implements no connection logic, use jack.plumbing(1) instead.
EXAMPLE
192.0.0.1:~$ jack.udp -r 192.0.0.2 send
192.0.0.2:~$ jack.udp recv
AUTHOR
Rohan Drape http://slavepianos.org/rd/
SEE ALSO
jackd(1)
AUTHOR
Rohan Drape <rd@slavepianos.org>
Author.
01/10/2012 JACK.UDP(1)