Pulseaudio to output RTP to internet - vlc

I want pulseaudio (remote instance) to push audio sent to the primary alsa device straight to RTP over the internet so that I could listen to it on VLC on my home computer.
in my /etc/pulse/default.pa
load-module module-rtp-send source=alsa_output.0.analog-stereo.monitor destination=x.x.x.x port=8080 loop=1
Where x.x.x.x is the internet IP of my server
After starting pulseaudio,netstat shows (I cannot connect from remote VLC to this)
udp 0 0 10.170.94.16:58606 x.x.x.x:9875 ESTABLISHED 2109/pulseaudio
udp 0 0 10.170.94.16:35597 x.x.x.x:8080 ESTABLISHED 2109/pulseaudio
It works with cvlc to produce the intended results (I can connect from remove VLC to this)
cvlc -vvv pulse://alsa_output.0.analog-stereo.monitor --sout '#transcode{acodec=mpga,ab=32,channels:1}:rtp{sdp=rtsp://0.0.0.0:8080/test.sdp}'
which produces
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1944/pulseaudio
And I can connect to it.
So what I think I understand is that pulseaudio is working correctly, and is sending the audio to port 8080. However, it's not listening for incoming connections to route the data to. How would I tell pulseaudio, or set up the routing so that port 8080 transmits the audio provided by rtp when an inbound connection occurs. I also see that cvlc is using rtsp as the source.
Still a bit confused..

RTP uses the stateless UDP protocol as a transport: it does not require the destination end to acknowledge any incoming packets. It cannot tell you if the connection has actually been established, other than if the remote end explicitly rejected it. This feature allows for doing broadcast on a LAN because multiple clients can listen to the packets as they wish, but it makes debugging unicast connections slightly more complicated.
When doing unicast UDP (like you are trying to achieve), once it's out on the Internet, it should get to your destination. Do you have a firewall? Unless your machine is connected directly to your modem, it is very likely that you have at least network address translation which would prevent the packets from reaching your computer. Look for port forwarding in your gateway/router configuration.
You can test if you are actually receiving the packets by using tcpdump. When running it, you will see some noise from other connections, along with packets that look like this:
08:19:38.483895 IP y.y.y.y.zzzz > x.x.x.x:8080: UDP, length 1292
Also, PulseAudio does not use RTSP, so VLC needs to open an RTP stream only. Simply typing rtp://0.0.0.0:8080 should do it.

Related

Can't track applications network communication under same machine

I have a network application environment of 7 applications communicating with eachother through UDP and TCP. All of them using either the machine's local network IP or 127.0.0.1 (localhost) to listen on ports or connecting to eachother.
All these applications are running on a single test machine.
I want to analyze precisely how each application communicate with the others so I tried Wireshark and Netmon. However both Wireshark and Netmon don't show me any of the packets sent or received by any of these applications.
What can I do to analyze this environment? Does Wireshark or Netmon able to analyze that? Is there a problem tracking packets using same source and destination IP?
what interface did you select in Wireshark for capturing traffic?
For your case, I think you should select "Adapter for loopback traffic" in Wireshark.
It will capture loopback communication for your locally hosted application.

Destination host not receive UDP message from source host using TIdUDPServer.Send

I use TIdUDPServer in this scenario:
Host 192.168.1.10: IdUDPServer1.Active := True using dynamic port (e.g.: 60112)
Host 192.168.1.20: IdUDPServer2.Active := True using dynamic port (e.g.: 50332)
When I invoke IdUDPServer1.Send('192.168.1.20', 50332, 'Hello'), the host
192.168.1.20 didn't receive any UDP message.
I then invoke IdUDPServer2.Send('192.168.1.10', 60112, 'Hello'), the host 192.168.1.10 receive the UDP message. Both hosts are able to receive UDP messages from each other then.
Similarly, if I send message from IdUDPServer2 first, the IdUDPServer1 will not receive any UDP message.
This strange problem always happens to UDP server that first send a message.
This problem doesn't happen if both IdUDPServer1 and IdUDPServer2 started in same host (e.g.: localhost or same pc).
I didn't assign any port number to both TIdUDPServer instance and let the library to assign a dynamic port for me. Hence, Windows 10 didn't prompt any Firewall warning.

Socket connection with different ports

I'm trying to run a socket connection from my iOS app to a bespoke server.
The iOS communicates via UDP to the server on port 12345. The request needs to come from socket 54321 on the device.
How do I open up a socket connection on iOS that communicates to a server on one port but listens via a different port.
I have followed the example on:
https://www.raywenderlich.com/3932/networking-tutorial-for-ios-how-to-create-a-socket-based-iphone-app-and-server
But this does not cover the local port
I have also looked at the documentation on https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html but I am finding it unclear due to my limited knowledge of socket connections.
I am currently attempting to use https://github.com/robbiehanson/CocoaAsyncSocket/wiki/Reference_GCDAsyncSocket
But I don't seem to be able to control the local port.
Thanks in advance
Normally you don't care about the sending socket, but when you create your AsyncUDPSocket you can use bindToPort: to set its port. Then use sendData:toHost:port:timeout:tag: to send the data

Installing Wireshark on server to capture web service SOAP request and response

I am new to using Wireshark. Can I install Wireshark on server which is hosting Web Service to capture incoming requests and out going responses?
Example end point URL of my Web Service: http://MyIP:9086/WebService
For example my web service is using 9086 port. If I start capturing traffic on 9086, will it give me all request and response (SOAP messages)?
I have installed Wireshark on local laptop and can packets when SOAP UI send request to Web Service. But I want to install it on server and want to capture from that end. Is that feasible?
If the server is a linux box, you can use tcpdump, and tell it dump the traffic into a pcap file. This pcap file you can transfer to a local machine and load into wireshark.
From https://www.wireshark.org/docs/wsug_html_chunked/AppToolstcpdump.html
D.3. tcpdump: Capturing with tcpdump for viewing with Wireshark
It’s often more useful to capture packets using tcpdump rather than wireshark. For example, you might want to do a remote capture and either don’t have GUI access or don’t have Wireshark installed on the remote machine.
Older versions of tcpdump truncate packets to 68 or 96 bytes. If this is the case, use -s to capture full-sized packets:
$ tcpdump -i <interface> -s 65535 -w <some-file>
You will have to specify the correct interface and the name of a file to save into. In addition, you will have to terminate the capture with ^C when you believe you have captured enough packets.

Monitor data transmission on TCP/IP adress and/or Port using wireshark

I made a C# program with a client and a server that comunicates fine between them. Information is received by the server and stored in a MySQL Database with no problems. However I wanted to use wireshark to monitor how safe/encrypted was the information and couldn't find the communication using wireshark. My program uses sockets to connect the server and client, on my test the server and client are running at adress 127.0.0.1 or local IP machine (something like 192.168.13.191), server listens/connects using port 3608 and client a much higher random port, and all the filters I used on wireshark return nothing.
So far I tried:
ip.addr == 127.0.0.1 (show only packages whose origin or destination are 127.0.0.1)
ip.addr == 192.168.13.191 (same as above)
tcp.port == 3608 (show only packages whose origin or destination is this port)
tcp.port == client_port (same as above)
tcp contains 01:00:00:3B (only packages with a few of the bytes I'm sending)
My idea was to find at least one message from the client to server and use the "Follow TCP stream" option from wireshark, but all these filters return a black screen when used individually. I have no idea why, because when I run netstat -a on a windows command I can see the program have a established connection and is also listening for new connections on port 3608. Anyone have any idea what is going on or what filter should I use? Operational system somehow is "redirecting" traffic from port 3608 to another?
Thanks!
Wireshark doesn't pick up loopback packets. You'll have to install the client or server on another machine and then try again.
EDIT: After doing some reading I've discovered that this really doesn't have anything to do with Wireshark but with the way WinPcap works. In any case, running the client or server on another machine will solve the problem.

Resources