Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3310906
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:48:52+00:00 2026-05-17T21:48:52+00:00

I would like to have some advices because I’ve got conflict between clients sending

  • 0

I would like to have some advices because I’ve got conflict between clients sending RTSP messages to the server.
First at all I apologize to you all for my English.

Well, what I’m doing is a java streaming video application.

  • clients set TCP connection with the server for exchanging RTSP messages

  • server sends over UDP, to the client requesting, frames in RTP packets using JPEG Payload Type because my video is in MotionJPEG format.

To be more specific:

  1. Server uses Threads to handle clients TCP connection on the same port
  2. Every client connected sent to the server the port wants to use for UDP transmission.

The problem is that the server receive and analize RTSP messages on tcp communication but when a client more connect to server, RTPS messages confuse orders and my server want to convert to integer where are just string, take session number from “unicast” written and so on…

This is what I do to handle different clients:

  ServerSocket socket = new ServerSocket(7777);
    while(true) {
        System.out.println("\nAspettando una connessione...");
        Socket incoming = socket.accept();
        Server server = new Server(incoming);
        Thread t = new Thread(server);
        t.start();
    }

My class Server implements Runnable to handle the timer to play, pause and stop the streaming.

Well it works providing video streaming to one client, but the server confuses RTSP on TCP requestes from clients that freeze. If I close those and open a third one it starts to work again because server understands what is receiving.


To be more specific the exceptions in server depend on the RTSP message clients are sending. For example

$Server (should receive Cseq) receives from (/192.168.0.4): Session: 12345678

$Server (should receive Cseq) from (/127.0.0.1): Cseq: 4

So exceptions could be:

Exception in thread "Thread-3" java.lang.NullPointerException
        at java.util.StringTokenizer.<init>(StringTokenizer.java:182)
        at java.util.StringTokenizer.<init>(StringTokenizer.java:219)
        at progetto2.Server.run(Server.java:91)
        at java.lang.Thread.run(Thread.java:619)

or

when is found Transport: RTP/UDP;unicast;client_port=8888\r\n
something like (I apologize I’ve lost the exception in thread line)

    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:449)
    at java.lang.Integer.parseInt(Integer.java:499)
    at progetto2.Server.run(Server.java:108)
    at java.lang.Thread.run(Thread.java:619)

So I should I handle different clients, should I use different TCP ports?
I’m sorry but I remember for multiclient chat I didn’t have these problems.
I hope to have explained my problem in the best way.

Thank you to everyone for helping and advicing me!

Kind regards!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:48:52+00:00Added an answer on May 17, 2026 at 9:48 pm

    The situation you describe is impossible. TCP does not reorder messages nor merge messages from different clients. You have a bug in your code. Probably something is static that should be an instance variable in your Server class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have some space between the same line.. I know there
I would like to have some functionality by which if I write <textarea maxlength=50></textarea>
I have some files in my SVN repository that I would like to have
I have some text in a UITextView, that I would like to have show
I have some files that I would like to rename using regex and powershell,
I have some data that I would like to visualize. Each byte of the
If you have some blocks of code that you would like to prevent execution
I have some data from log files and would like to group entries by
I have some Objective-C [i-os] code that I would like to run unit tests
I have some auto-instantiation code which I would like to apply to about 15

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.