I found code of simple client - server application using TCP sockets, written in C#: http://www.csharphelp.com/archives/archive127.html . It makes possible to send and receive text. What I'd like to do is to send audio from one application to the other, I don't have to have communication in the opposite direction. Can you help me, please, how to change the code so that it can send audio, not text?

In general I've got Skype and Sphinx4 (speech recognition engine). Normally Skype sends speech to the speaker and Sphinx4 receives speech from the microphone:
( Skype -> speaker ) AND ( microphone -> Sphinx4 )
I'd like to change it to:
( Skype -> Sphinx4 )
However I guess it cannot be done directly, so perhaps it should be:
( Skype -> socket -> Sphinx4 )
And now my question is how to send speech from Skype to socket. I will take care of things connected with Skype later. Now what I'd like to do is only to know how to send speech instead of text in client - server application.


7 Years
Discussion Span
Last Post by sknake

sending information over a network is done using a stream. you write bytes to it. these bytes can be anything. Text, audio, pictures, whatever. Its simple, just find a way to compress your audio, but once compressed, instead of writing it to a file stream, write it to your network stream.

then on the receiving end, decompress you buffer and use it. If it is more important the audio be fast and not perfect then I suggest UDP over TCP but that's trivial. I don't have any free time to provide any code or further suggestions, but I hope this helps.


I would use UDP over TCP if you're streaming the data, but not if you're transferring a file. UDP is a stateless method of sending data and does not validate data integrity, which is analagous to how the radio and telephones work. If the packet is lost you will not hear that sound byte, instead of waiting for a packet retransmission.

Imagine for instance if telephones used "TCP" instead of "UDP" -- Then instead of a phone call dropping out for a second or so (think of your cell phone) the data would "catch back up" and replay the last second you missed, plus the new parts of the conversation. So instead of it dropping out you would probably hear alvin and the chimpmunks style high speed dubbing :P -- VoIP phones use a type of real time protocol, or RTP, for transmitting conversation information.

Anyway to answer your question on file transfers please take a look at this thread:

In that thread we covered sending binary files.

Edited by sknake: n/a

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.