473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Socket based Real-Time connection

Hi there,

I need to implement a sort of RTP/RTSP. Nothing impossible, just a
"minimal" implementation Anyway I need to know something more about how
could I create real-time connection using the .NET socket class. Is it
enough to write/read data in synchronous way? If not, could you link me
to some resources in the net?

Thanks in advance,
Giulio - Italia

--
OnAir:
Mar 5 '07 #1
6 9109
On Mon, 05 Mar 2007 11:50:39 +0100, Giulio Petrucci wrote:
I need to implement a sort of RTP/RTSP. Nothing impossible, just a
"minimal" implementation Anyway I need to know something more about how
could I create real-time connection using the .NET socket class. Is it
enough to write/read data in synchronous way? If not, could you link me
to some resources in the net?
RTP/RTSP are documented, standard protocols that are usually implemented
over UDP although you can implements them over TCP or other protocols if
you want. These protocols do not require any kind of special "real-time"
sockets (whatever that is), so the .NET Socket class is perfectly up to the
task.

If you're going to implement them, i'd highly recommend you to read "RTP -
Audio and Video for the Internet" by Colin Perkins which will provide a lot
of help in the design of your application.

For an example implementation in .NET, have a look at Microsoft's open
source Conference XP project <http://research.microsoft.com/conferencexp/>
Note that their RTP stack is not fully standard compliant though but in
case you need re-assurance that it works, then this is the proof you need.

Af for synchronous vs asynchronous socket calls, it all depends on what you
want your application to do. Synchronous appears simpler at first as it
allows you to have a single function (typically running in it own thread)
that does all the networking work, usually in a loop. It looks cleaner. But
it forces you to have one thread per client which rapidly kills performance
when the number of connected clients goes up. Asynchronous might looks more
difficult and messy at first but once you've practiced a bit, it's pretty
much straighforward and will allow your application to scale up better.
Mar 5 '07 #2
Hi Mehdi,

first of all: thank you for your reply.

Mehdi ha scritto:
RTP/RTSP are documented, standard protocols that are usually implemented
over UDP although you can implements them over TCP or other protocols if
you want.
I need to implementi it over TCN necessarily.
These protocols do not require any kind of special "real-time"
sockets (whatever that is), so the .NET Socket class is perfectly up to the
task.
good! :-)
If you're going to implement them, i'd highly recommend you to read "RTP -
Audio and Video for the Internet" by Colin Perkins which will provide a lot
of help in the design of your application.
Thank you for your suggestion!
For an example implementation in .NET, have a look at Microsoft's open
source Conference XP project <http://research.microsoft.com/conferencexp/>
Note that their RTP stack is not fully standard compliant though but in
case you need re-assurance that it works, then this is the proof you need.
I searched but found nothing interesting (well, I should say "I found
nothing" at all :-( ). Please, could you paste here some more detailed
links?
Af for synchronous vs asynchronous socket calls, it all depends on what you
want your application to do. Synchronous appears simpler at first as it
allows you to have a single function (typically running in it own thread)
that does all the networking work, usually in a loop. It looks cleaner. But
it forces you to have one thread per client which rapidly kills performance
when the number of connected clients goes up. Asynchronous might looks more
difficult and messy at first but once you've practiced a bit, it's pretty
much straighforward and will allow your application to scale up better.
Actually I can use async socket (I always use them when I can), but what
about the RT then? Shall I use it the same?

Thanks again!
Have a nice week,
Giulio

--
Mar 5 '07 #3
On Mon, 05 Mar 2007 13:36:15 +0100, Giulio Petrucci wrote:
Mehdi ha scritto:
>RTP/RTSP are documented, standard protocols that are usually implemented
over UDP although you can implements them over TCP or other protocols if
you want.

I need to implementi it over TCN necessarily.
I suppose that you mean TCP? Keep in mind that most real-time audio-video
systems are implemented on top of UDP rather than TCP as obviously UDP is
better suited for the task (although UDP also introduces loads of
additional problems). If you're going to do that on top of TCP, you'll need
to remember that TCP ensures that all the packets you send on the network
are received and are received in the proper order. This a good in a sense
as it means that you do not have to worry about missing or out-of-order
packets but that means that if a packets fails to be received, TCP will
keep re-sending it until it is received by the other end, hence introducing
delay which is very bad in the case of a real-time AV system. You'll need
to code to detect such delay build-up and reduce it.

You might also want to disable the Nagle algorithm on your Socket if you
want to do real-time communication over TCP.
>For an example implementation in .NET, have a look at Microsoft's open
source Conference XP project <http://research.microsoft.com/conferencexp/>
Note that their RTP stack is not fully standard compliant though but in
case you need re-assurance that it works, then this is the proof you need.

I searched but found nothing interesting (well, I should say "I found
nothing" at all :-( ). Please, could you paste here some more detailed
links?
Conference XP is a project aimed at providing an extensible framework for
high quality audio/video conferencing. It also has other features such as
text chat, slide sharing, etc. They are using RTP over multicast UDP for
all the network communications. You can download the source code from the
main page <http://research.microsoft.com/conferencexp/>. There are several
solution and projects in there, one of which is their network stack
implementing their own non-standard-compliant RTP stack. I don't remember
how it's called, probably RTP- or Network-something. Although you probably
won't be able to re-use much or any of their code (which can not be used
for commercial purposes by the way), it should give you an idea of what
implementing RTP in .NET can look like.

You might be interested in this video as well:
<http://research.microsoft.com/conferencexp/library/workshop2005/videos/12424/default.htm>
(taken from their ressources page
<http://research.microsoft.com/conferencexp/resources_library.aspx>). It
presents an overview of Conference XP. In particular, at around 48 minutes
into the video, Jason gives a short introduction to RTP and explains how
they've implemented it in Conference XP. If you're new to RTP, this might
be useful.
Actually I can use async socket (I always use them when I can), but what
about the RT then? Shall I use it the same?
Real-time in this case simply means trying to achieve as low latency as
possible. And that has pretty much nothing to do with
synchronous/asynchronous. If you're comfortable already with asynchronous
socket programming then go for it espcially if you want you RTP stack to be
able to scale up to more than a few clients.
Mar 5 '07 #4
Hi Mehdi,

Mehdi ha scritto:
I suppose that you mean TCP?
Ops...
Sure: I meant TCP!
You might also want to disable the Nagle algorithm on your Socket if you
want to do real-time communication over TCP.
Good shot! I haven't thought about it before.
Real-time in this case simply means trying to achieve as low latency as
possible. And that has pretty much nothing to do with
synchronous/asynchronous. If you're comfortable already with asynchronous
socket programming then go for it espcially if you want you RTP stack to be
able to scale up to more than a few clients.
Thanks for your suggestions!

Cheers,
Giulio

--
OnAir: Judas Priest - "You've got another thing coming"
Mar 5 '07 #5
Mehdi ha scritto:
You might also want to disable the Nagle algorithm on your Socket if you
want to do real-time communication over TCP.
....by the way: I can I disable it?
;-)

Cheers,
Giulio - Italia

--
OnAir:
Mar 5 '07 #6
Giulio Petrucci wrote:
Mehdi ha scritto:
You might also want to disable the Nagle algorithm on your Socket if you
want to do real-time communication over TCP.

...by the way: I can I disable it?
www.google.com/search?q=disable+nagle+c%23 - second entry.

-- Barry

--
http://barrkel.blogspot.com/
Mar 5 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex | last post by:
Hi, I am programming asynchronous communication between client and server, with .net asynchronous sockets example from MSDN...
1
by: Tapio Kelloniemi | last post by:
Hi I didn't find this one from the FAQ: I'm writing an input parser for numbers. Everything else is piece of Cake, except how to parse real numbers that are in some other base than 10, eg....
3
by: zbcong | last post by:
hello i found there are three socket programming architectures from dotnet:synchronized socket,asynchronized socket and TcpListener. i know that the asynchronized socket is non-blocking socket.i...
4
by: Ken Foster | last post by:
I have a Socket based application using the asynchronous Sends and Receives of the Socket class. I send out XML strings using BeginSend/EndSend from a client end point, the server side does a...
1
by: Ken Foster | last post by:
I have a Socket based application using the asynchronous Sends and Receives of the Socket class. I send out XML strings using BeginSend/EndSend from a client end point, the server side does a...
2
by: djc | last post by:
I read a network programming book (based on framework 1.1) which indicated that you should 'never' use the RecieveTimeout or the SendTimeout 'socket options' on TCP sockets or you may loose data. I...
2
by: Macca | last post by:
Hi, I have written an asychronous socket based on the microsoft example below :- http://msdn2.microsoft.com/en-gb/5w7b7x5f.aspx My app is connected to multiple clients which connect to the...
5
by: Dmitri Sologoubenko | last post by:
Anyone have experieced this stuff? Have any sample code? Please le me know. Thanks a lot, D
6
by: billie | last post by:
Hi all. I'm writing a TCP-based application that I will use to trasfer binary files through the network. This piece of code represents how do I get a file from a remote peer and save it on my local...
3
by: Venturini | last post by:
I am trying to put together a web page where the customer makes choices of products and is then given a total. I am extremely new to Javascript and have managed to get as far as I have from web...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.