Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Problem about java socket server on TCP Protocol

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem about java socket server on TCP Protocol

    Hi
    Now I am developing a java socket server on TCP Protocol, server listen port 9998 and wait client to connect,when a client connect to server, socket server create a new process for communication,the process do "while(1);" ,if the socket server receive character string "bye",then a break is execute and jump out of "while(1);" ,the process is ended.
    I hava a need but I do not how to do:
    I want socket server can stop some one process ,in other word ,I want server send string "bye" via socket , I think it may impossible, is there any other way to realise this function?
    Thank You.

    Best Regard
    FRT


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,388
    My Mood
    Mellow
    Thanks
    143
    Thanked 599 Times in 586 Posts

    Default Re: Problem about java socket server on TCP Protocol

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

  3. #3
    Junior Member
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Problem about java socket server on TCP Protocol

    Hi
    Now I am developing a java socket server on TCP Protocol, server listen port 9998 and wait client to connect,when a client connect to server, socket server create a new process for communication,the process do "while(1);" ,if the socket server receive character string "bye",then a break is execute and jump out of "while(1);" ,the process is ended.
    I hava a need but I do not how to do:
    I want socket server can stop some one process ,in other word ,I want server send string "bye" via socket , I think it may impossible, is there any other way to realise this function?
    Thank You.

    Best Regard
    FRT

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem about java socket server on TCP Protocol

    Duplicate threads merged
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem about java socket server on TCP Protocol

    could you explain how to do it in detail ? thanks!

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem about java socket server on TCP Protocol

    Do a search here on the forum for some sample client sever code. Find one that is simple enough to work with, copy the code to your computer, compile it, fix the bugs and execute it for testing.
    When it works, start making changes to it to follow the design you have for the way you want it to work.
    When you have problems, post the code and any error messages or questions you have.

    BTW while(1) is NOT java code, 1 is an int not a boolean. You probably mean: while(true)
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. TCP Java Socket Server
    By vviston in forum Java Networking
    Replies: 3
    Last Post: March 24th, 2014, 05:36 AM
  2. java Client Server program by using socket problem
    By Mad Engineer in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 31st, 2013, 10:57 AM
  3. Java socket server problem
    By Lionlev in forum Java Networking
    Replies: 6
    Last Post: May 27th, 2012, 11:22 AM
  4. Re: Java socket server problem
    By viperhastle in forum Java Networking
    Replies: 1
    Last Post: May 27th, 2012, 11:21 AM
  5. Replies: 0
    Last Post: February 24th, 2011, 05:31 AM

Tags for this Thread