datagram

Stream from Android device to shoutcast (upstreaming)

限于喜欢 提交于 2019-12-07 01:13:29
Thanks to all of you in advance :) I want to make it clear before you start reading that I want to develop an android based app to use android device as a broadcaster, which records sound using its mic and sent it to shoutcast server something like this: Android Device with internet connection -> Shoutcast Server -> listeners. So please do not get confused with playing shoutcast streams on android, because I do not want to develop a player to play an stream. If you are looking for developing a player then download source code from given link, it worked fine for me. Click to download Source

is DatagramSocket.send thread safe?

梦想的初衷 提交于 2019-12-06 18:11:02
问题 I'm planning to use an instance of DatagramSocket and call its send method from different threads... to send UDP packets to different clients. Is the method thread safe i.e. calling this method from different threads will not create any trouble/inconsistency/race condition? Thanks! 回答1: UDP guarantees that datagrams arrive intact (if at all). In other words there can be no interleaving even if there is multithreading at the sender. That's all you need. You don't actually need thread safety.

UDP - Read data from the queue in chunks

末鹿安然 提交于 2019-12-06 11:57:38
I'm implementing a small application using UDP (in C). A server sends to a client the data from a given file in chunks of given amount (ex. 100 bytes / call). The client downloads the file and saves it somewhere. The catch is that the client can receive a parameter saying how many bytes to read / call. My problem is when the server sends 100 bytes / call, and the client is set to read only 15 bytes / call. The other 85 bytes are lost, because the message is removed from the UDP queue. Is there a way to read these messages in chunks without removing them from the queue until they're completely

Spoof source IP/Port with DatagramPacket

前提是你 提交于 2019-12-06 11:57:09
Is there any way to spoof the source IP/Port of a DatagramPacket object in Java? Paul Rubel Raw Socket is a term that'll help your search. You can look at the following question: Best way to do RAW socket programming involving Java They recommend a raw-socket wrapper, rocksaw . 来源: https://stackoverflow.com/questions/10626262/spoof-source-ip-port-with-datagrampacket

How to send audio stream via UDP in java?

两盒软妹~` 提交于 2019-12-06 06:54:26
问题 I have a problem, i have set MediaLocator to microphone input, and then created Player. I need to grab that sound from the microphone, encode it to some lower quality stream, and send it as a datagram packet via UDP. Here's the code, i found most of it online and adapted it to my app: public class AudioSender extends Thread { private MediaLocator ml = new MediaLocator("javasound://44100"); private DatagramSocket socket; private boolean transmitting; private Player player; TargetDataLine mic;

DatagramSocket cannot receive data from UdpClient

♀尐吖头ヾ 提交于 2019-12-06 06:46:05
问题 I am making an Win RT app that connects to a desktop app and they start to communicate in UDP and TCP. I have successfully implemented TCP communication in that I can send from Win RT to Desktop and send from Desktop to Win RT. using StreamSocket on Win RT and TcpListener on desktop. I also made it to send Udp data from Win RT to desktop without any problem. But I can't receive data's sent from desktop to Win RT. I use the following code and I don't see any problem with that but there must

how can I send raw packets over wifi without a network?

别说谁变了你拦得住时间么 提交于 2019-12-06 01:29:51
I am trying to send some data between 2 raspberry pi's over wifi without them being connected to a network. I want it to work similar to the way beacons and probe requests work, where a broadcast can be sent out the wireless interface. the data I want to send will be the hostname of the device and the time the packet was sent. I've been trying to figure this out for the last few days but I cannot get anything to work without them being on the same network. Is anybody able to point me in the right direction? I'm not too fussed about what language I use. I have been trying python and C with

Using QUdpSocket to send datagrams

蓝咒 提交于 2019-12-05 20:53:10
I am trying to send a datagram using QUdpSocket. The following is the code I am using: udpSocket = new QUdpSocket(this); QByteArray datagram = "Message"; udpSocket->writeDatagram(datagram.data(), datagram.size(), QHostAddress::Broadcast, 45454); Now if I run this on a computer that has only one network adapter, it seems to work with no problem. However, if there are multiple adapters, I need to be able to control which is used to send the datagram. I have found that if I bind the socket as follows: udpSocket->bind(QHostAddress("192.168.1.104"), 45454); then I can force the datagram to be sent

DatagramSocket cannot receive data from UdpClient

时光总嘲笑我的痴心妄想 提交于 2019-12-04 15:21:52
I am making an Win RT app that connects to a desktop app and they start to communicate in UDP and TCP. I have successfully implemented TCP communication in that I can send from Win RT to Desktop and send from Desktop to Win RT. using StreamSocket on Win RT and TcpListener on desktop. I also made it to send Udp data from Win RT to desktop without any problem. But I can't receive data's sent from desktop to Win RT. I use the following code and I don't see any problem with that but there must something. var g = new DatagramSocket(); g.MessageReceived += g_MessageReceived; g.BindEndpointAsync(new

How to send audio stream via UDP in java?

两盒软妹~` 提交于 2019-12-04 14:29:21
I have a problem, i have set MediaLocator to microphone input, and then created Player. I need to grab that sound from the microphone, encode it to some lower quality stream, and send it as a datagram packet via UDP. Here's the code, i found most of it online and adapted it to my app: public class AudioSender extends Thread { private MediaLocator ml = new MediaLocator("javasound://44100"); private DatagramSocket socket; private boolean transmitting; private Player player; TargetDataLine mic; byte[] buffer; private AudioFormat format; private DatagramSocket datagramSocket(){ try { return new