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 5 of 5

Thread: Connect to the server using java servlet

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Connect to the server using java servlet

    Hi All, I am new to Java programming.

    I would like to do below task.

    I have a server (for example 11.81.19.74, port : 5252). In this server side The python script running at the port 5252 to receive request(latest_values) from the client and give reply(some values) back to client.
    In my development pc (11.81.19.100) , I need to write a servlet application , that communicates with the server 11.81.19.74 at the port 5252 and receive data from the server.

    Can you please suggestion how can i achieve this, i tried a lot in the web , i could not able to find the examples on this.

    I do not know how to communicate with the server at this point.

    Please suggest or if you provide any useful example code that would be great.

    Many thanks,
    Chandra


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Connect to the server using java servlet

    Welcome to Java Programming Forums. How do you want to communicate to the server? Do you want to fetch data or post data from/to the server?
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Connect to the server using java servlet

    Hi Henry,

    I want to post data ( for example "latest_values" message )from the client(11.81.19.100) to the server, when the server (python script running on the server (11.81.19.74, port : 5252)to receive data from the client) receives "latest_values" message from the client, the server send back another message to the client.

    So at the client side , i need to implement servelt ,that send data to the server and receive data from the server using doGet() or doPost() methods.


    Many thanks,
    Chandra

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Connect to the server using java servlet

    I really didn't understand what you mean to say but however, is this the one you are looking for?
    Connecting Python to a Java Rest Servlet using POST | Natural Order Development
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Connect to the server using java servlet

    A Socket should allow you to connect to a server, send it a request and receive a response.
    at the client side , i need to implement servelt
    Can you describe what software will run on your PC? I'm confused by servlet? Normally servlets run on a server.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. connect to linux server from windows
    By ridg18 in forum Java Theory & Questions
    Replies: 6
    Last Post: June 17th, 2013, 05:35 AM
  2. Replies: 7
    Last Post: December 28th, 2012, 10:48 AM
  3. Java Code to connect remote server
    By idealguy in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 3rd, 2012, 04:59 AM
  4. Connect to SQL server 2008
    By vahidbakhtiary in forum JDBC & Databases
    Replies: 1
    Last Post: July 2nd, 2012, 10:07 AM
  5. Cannot Connect to Server
    By Brt93yoda in forum Java Networking
    Replies: 0
    Last Post: December 9th, 2010, 05:54 PM

Tags for this Thread