This is a wrong forum, since you are asking question about C, not Java :) Anyway...
I dont get the problem really. Berkley or not, UDP sockets are the same in C, C++, or Java , PHP, Perl or anything else. There are normally 2 functions namely, recv and recvfrom (as viewed in C, http://www.hmug.org/man/2/recv.php)
ssize_t
recv(int s, void *buf, size_t len, int flags);
recv() you will use when you dont know from which IP address the data will be coming.
ssize_t
recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from,
socklen_t *fromlen);
recvfrom() you will use, to receive data from a specific IP address.
That's for C. C++ is just a wrapper for these 2 functions that makes it ea. Here's tutorial http://www.alhem.net/Sockets/tutorial/.
The point is to just receive the data into some buffer, that's all. You do it the same way you receive anything else on the UDP socket. However, in RTP you'll have to create 2 sockets:
1. To receive RTP data (real audio/video) - in JMF runs on any even port : 8000, 10020, 55552, etc and called "data port"
2. To receive RTCP data (i.e. control data) - in JMF runs on a data port + 1. For example, if data port is 8000, then your control port is 8001. If you dont want to use control port, omit it.
> This is a wrong forum, since you are asking question
> about C, not Java :) Anyway...
>
> I dont get the problem really. Berkley or not, UDP
> sockets are the same in C, C++, or Java , PHP, Perl
> or anything else. There are normally 2 functions
> namely, recv and recvfrom (as viewed in C,
> http://www.hmug.org/man/2/recv.php)
>
> ssize_t
>recv(int s, void *buf, size_t len, int flags);
> v() you will use when you dont know from which IP
> address the data will be coming.
>
> ssize_t
> recvfrom(int s, void *buf, size_t len, int
> flags, struct sockaddr *from,
> socklen_t *fromlen);
> om() you will use, to receive data from a specific IP
> address.
>
> That's for C. C++ is just a wrapper for these 2
> functions that makes it ea. Here's tutorial
> http://www.alhem.net/Sockets/tutorial/.
>
> The point is to just receive the data into some
> buffer, that's all. You do it the same way you
> receive anything else on the UDP socket. However, in
> RTP you'll have to create 2 sockets:
>
> 1. To receive RTP data (real audio/video) - in JMF
> runs on any even port : 8000, 10020, 55552, etc and
> called "data port"
> 2. To receive RTCP data (i.e. control data) - in JMF
> runs on a data port + 1. For example, if data port is
> 8000, then your control port is 8001. If you dont
> want to use control port, omit it.
Hi. I am using the AVTransmit 3 code and it says it uses sockets and RTPConnect.java. What happens is i run the java side (AVT3) fine but i get "socket binding error" when running the C++ side. Is it because the AVT3 isnt really using sockets or i did something wrong? please help. Thanks
Dear andreyvk ,
I've read your post about how to use a single RTP session for both media reception and trasmission (I'm referring to you RTPSocketAdapter modified version), but, at the moment, I'receive a BIND error.
I think that your post is an EXCELLENT solution. I'modified AVReceive3 and AVTransmit3 in order to accept all parameters (Local IP & Port, Remote IP & Port).
Can you please give me a simple scenario so I can understand what the mistake?
I'use AVTransmit3 and AVReceive3 from different prompts and if I run these 2 classes contemporarely both in 2 different PC (172.17.32.27 and 172.17.32.30) I can transmit the media (vfw://0 for example) using AVTransmit3 but I'can't receive nothing if I run also AVReceive3 in the same PC?
What's the problem? Furthermore, If I run first AVReceive3 from a MSDOS Prompt and subsequently I run AVTransmit3 from another prompt I see a BIND error (port already in use).
How can I use your modified RTPSocketAdapter in order to send and receive a single media from the same port (e.g. 7500).
I've used this scenario PC1: IP 172.17.32.30 Local Port 5000 and PC2:IP 172.17.32.27 LocalPort 10000
So in the PC1 I run:
AVTransmit3 vfw://0 <Local IP 172.17.32.30> <5000> <Remote IP 172.17.32.27> <10000>
AVReceive3 <Local IP 172.17.32.30/5000> <Remote IP 172.17.32.27/10000>
and in PC2:
AVTransmit3 vfw://0 <Local IP 172.17.32.27> <10000> <Remote IP 172.17.32.30> <5000>
AVReceive3 <Local IP 172.17.32.27/10000> <Remote IP 172.17.32.30/5000>
I'd like to use the same port 5000 (in PC1) and 10000 (in PC2) in order to transmit and receive rtp packets. How can i do that without receive a Bind Error? How can I receive packets (and playing these media if audio &/or video) from the same port used to send stream over the network?
How can I obtain a RTP Symmetric Transmission/Reception solution?
Please give me an hint. If you can't post this is my email: Siracg99@libero.it