473,414 Members | 1,598 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,414 software developers and data experts.

server client connection set up for streaming

I am trying to set up a server client network .Server will be able to stream live audio captured from a radio receiver connected to its line in port to multiple clients over the network.

Gstreamer is used for setting up the RTSP(Real Time Streaming Protocol) based server.And at the client side i used VLC Media player to open the input network stream by specifying the IP adress & default port no of server.

C code which i used for setting up the streaming server goes like:
Expand|Select|Wrap|Line Numbers
  1. #include <gst/gst.h>
  2. #include <gst/rtsp-server/rtsp-server.h>
  3.  
  4. /* define this if you want the resource to only be available when using
  5. * user/admin as the password */
  6.  
  7. #undef WITH_AUTH
  8.  
  9. /* this timeout is periodically run to clean up the expired sessions from the
  10.  * pool. This needs to be run explicitly currently but might be done
  11. * automatically as part of the mainloop. */
  12.  
  13. static gboolean
  14.  
  15. timeout (GstRTSPServer * server, gboolean ignored)
  16. {
  17.   GstRTSPSessionPool *pool;
  18.  
  19.   pool = gst_rtsp_server_get_session_pool (server);
  20.  
  21.   gst_rtsp_session_pool_cleanup (pool);
  22.  
  23.   g_object_unref (pool)
  24.  
  25.   return TRUE;
  26. }
  27.  
  28. Int
  29.  
  30. main (int argc, char *argv[])
  31.  
  32. {
  33.  
  34.   GMainLoop *loop;
  35.  
  36.   GstRTSPServer *server;
  37.  
  38.   GstRTSPMediaMapping *mapping;
  39.  
  40.   GstRTSPMediaFactory *factory;
  41.  
  42. #ifdef WITH_AUTH
  43.  
  44.   GstRTSPAuth *auth;
  45.  
  46.   gchar *basic;
  47.  
  48. #endif
  49.  
  50.   gst_init (&argc, &argv);
  51.  
  52.   loop = g_main_loop_new (NULL, FALSE);
  53.  
  54.   /* create a server instance */
  55.  
  56.   server = gst_rtsp_server_new ();
  57.  
  58.   /* get the mapping for this server, every server has a default mapper object
  59.   * that be used to map uri mount points to media factories */
  60.  
  61.   mapping = gst_rtsp_server_get_media_mapping (server);
  62.  
  63. #ifdef WITH_AUTH
  64.  
  65.   /* make a new authentication manager. it can be added to control access to all
  66.  * the factories on the server or on individual factories. */
  67.  
  68.   auth = gst_rtsp_auth_new ();
  69.  
  70.   basic = gst_rtsp_auth_make_basic ("user", "admin");
  71.  
  72.   gst_rtsp_auth_set_basic (auth, basic); 
  73.  
  74.   g_free (basic);
  75.  
  76.   /* configure in the server */
  77.  
  78.   gst_rtsp_server_set_auth (server, auth);
  79.  
  80. #endif
  81.  
  82.   /* make a media factory for a test stream. The default media factory can use
  83.  
  84.    * gst-launch syntax to create pipelines. 
  85.  
  86.    * any launch line works as long as it contains    elements named pay%d. Each
  87.  
  88.    * element with pay%d names will be a stream */
  89.  
  90.   factory = gst_rtsp_media_factory_new ();
  91.  
  92.   gst_rtsp_media_factory_set_launch (factory, "( "
  93.  
  94.       "videotestsrc ! video/x-raw-yuv,width=352,height=288,framerate=15/1 ! "
  95.  
  96.       "x264enc ! rtph264pay name=pay0 pt=96 "
  97.  
  98.       "audiotestsrc ! audio/x-raw-int,rate=8000 ! "
  99.  
  100.       "alawenc ! rtppcmapay name=pay1 pt=97 " ")");
  101.  
  102.  
  103.   /* attach the test factory to the /test url */
  104.  
  105.   gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
  106.  
  107.   /* don't need the ref to the mapper anymore */
  108.  
  109.   g_object_unref (mapping);
  110.  
  111.   /* attach the server to the default maincontext */
  112.  
  113.   if (gst_rtsp_server_attach (server, NULL) == 0)
  114.  
  115.     goto failed;
  116.  
  117.   /* add a timeout for the session cleanup */
  118.  
  119.   g_timeout_add_seconds (2, (GSourceFunc) timeout, server);
  120.  
  121.   /* start serving, this never stops */
  122.  
  123.   g_main_loop_run (loop);
  124.  
  125.   return 0;
  126.  
  127.   /* ERRORS */
  128.  
  129. failed:
  130.   {
  131.  
  132.     g_print ("failed to attach the server\n");
  133.  
  134.     return -1;
  135.  
  136.   }
  137.  
When tested with local host my client VLC was able to open the input stream successfully..and it did work well

But when tried with SERVER and CLIENT on different machines ,vlc displayed the following message:

connection was not established
VLC unable to open the MRL

I dont know why it is not working when tried with server and client on different machines.Help me answer these questions as i need to demonstrate streaming between a server and client computer by connecting using a LAN cable,as a part of my project .

1)Is this a connection failure? if yes ,how can i solve it?
actually i established the connection using a LAN CABLE ,and proxy was set on both sides identifiying one as server and other as client.

2)Do i need to modify the code?

3)Where do you think the problem is ? client side or server side?

Please some one help me with this........as i need to complete this project by next week
Apr 13 '11 #1
3 4500
sicarie
4,677 Expert Mod 4TB
Can you ping the proxy? Can you simulate the connection from both the client and the server - ensuring information can travel both ways?
Apr 15 '11 #2
ya,when i ping the proxy,it show that a connection exists,but when i try to open the input stream using vlc at the client side,it says that the connection is not being established
Apr 26 '11 #3
sicarie
4,677 Expert Mod 4TB
A ping wouldn't show a connection exists - it shows a path exists. Connections are usually shown through netstat output.

So both client/server can ping the proxy? Are there intermediate nodes?

Have you attempted to telnet to the ports that are expected on both the proxy and client/server? That will show that the ports are open and listening for the program to make a connection
May 2 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Michael Goettsche | last post by:
Hi there, I'm trying to write a simple server/client example. The client should be able to send text to the server and the server should distribute the text to all connected clients. However, it...
3
by: MBW | last post by:
The following code is for a simple server/client asplication that allows the user to toggle between serve and or client modes and send/recieve a message however i am getting an Attribute error on...
2
by: Prabhat | last post by:
Hi All, How can we fine if the SQL Server Client is Installed in the System or Not. (Using VB and/or Delphi) As My EXE Require SQL Server Client to Work so I have to Check that If the Client...
0
by: savia755 | last post by:
I created 2 forms, one I put in Apache to be called by another after I click a button on it. But whenever I call the application, I get a socket exception message that I can initialize only one...
3
by: pvrsatya | last post by:
hi all i am using TCP/Ip i am running server application in one PC client application in other PC i am connecting these thro PC's in LAN If i remove the LAN cable
4
by: lightyagami | last post by:
how to connect 2 pc in sql server,1 is server and 1 is client...? and also my question is,is it ok if the server runs in windows xp?or we need a windows NT? pls help me with my thesis...Thanks
0
by: 85ssp | last post by:
I am creating a small server client program that is meant for up to 70 connections from 70 different computers on a network. Everything in the program functions correctly except when testing...
3
by: dynamo08 | last post by:
Hi, I am new to socket programming, I wrote an ftpclient which connects to an ftp server and downloads a file to the client computer. Now in one client connection I want to download multiple files...
3
by: Hukkky | last post by:
I'm testing simple server/client codes on linux. just server can wait for client's connect sign and accept, and client can't connect to server, this is all. There's no problems just for this...
0
by: ryaneoghan | last post by:
hi, I was just wondering if anyone could help, i am trying to create a client and server socket connection in perl, i want to ask for name and then do a check on the name and ask for a secret word...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.