i am trying to develop a server and client for video stream using RTPS, now the problem is i am working on a stand-alone machine,
now i can transmitt the data from the server but when i make my client to listen to the same port where my server is transmitting the data an error is raised stating that
and my client is working properly when i invoke it first it will be checking for the server transmitting in the particular port but i can't start the server now, once again the same problem.
i know that it is the problem with port which can't be used once it has been bind, but i am working in a stand alone system, any solutions for this.
Well, client and server *must* use the same port, otherwise they won't be able to talk to each other. But there can only be a single server port, and it sounds as if the server isn't fully shut down when you try to restart it.
No, they don't have to use the same port... If he wants to stream from server to client why should the client be listening on any port? Why does he want to open a socket and listen on the client side? It seems as if he wants to add some server-stuff to the client-side.
If I open run a webserver on my local machine my browser can still access other webservers because there is no need that the client uses port 80 on the local side.
see my server(a java class) will start streaming a file using using RTSP and will specify the destination ip and port on to which i want to transmit
the client(again a java class) will be listening to the same port which the server specified to receive the data.
here my class will split the video and audio into two separate tracks and transmit them such a way that the second channel(audio track) will be streaming on a port that will be incremented by 2
port 5000 -> video track
port 5002 -> audio track
now on the client i have to listen to the two port simultaneously to receive the video and audio as well.
but couldn't do so stating that it is being bind already, i know this will happen but any solution to over come this
You cannot have two Socket listen to the same port on the same network interface. Why can't you let you client listen to port x and your server to y? Is it really necessary that your client opens a port and the server has to connect to it? Or can the client connect to the server?
Is it really necessary that your client opens a port and the server has to connect to it? Or can the client connect to the server?
i have the feasibility to do both
i can first run the server stream and can ask the client to listen to the port
i can first make the client to listen to a particular ports where it will be waiting for server to send the stream and once the server start the stream on the same port it will catch it.
is this the one you asked me or any thing else can you make it more clear
Also, the question has been answered twice in this topic. Have the client connect to the server's port. Do not have the client bind the port -- as the server is already using it (see the Socket bind() and connect() method).