• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

HttpURLConnectin, Sockets and Servlet problem

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i'm trying to build a messenger using jsp, servlets and applets. the server is a servlet. when you start it, the init() method will be called and a socketlistener on port 8051 will be opened. this works just fine. now i want to connect with my client (an applet) to this servlet over a HttpURLConnection. i can't get this to work somehow. i want to transfer messages through the URLConnection with this setRequest property. but somehow the message is not transfered. what am i doing wrong here? and also i want to write a message to the server using the printwriter. shouldn't the socketlistener be able to get and display this message? well i've no idea what i'm doing wrong. i hope someone can help. thanks already. here's the code:


 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why in the name of sanity do you expect your socket on 8051 to handle HttpURLConnections?
You appear to have the servlet init method Thread stuck forever.
The whole idea of servlet containers like Tomcat is to have the servlet container handle the basic connectivity and interpretation of HTTP requests so your servlet does not have to.
Go read a servlet tutorial and create some basic servlets before jumping into the middle of a complex project.
Bill
 
Isaac Jones
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well...thanks for you answer. it didn't help me that much though. so you wanna say that i can't connect to a socket with a urlconnection. or does this just doesn't make sense? isn't this multi-threaded? i should be able to get into the dopost / doget function, shouldn't i?
i've read thru some tutorials... but they didn't help a lot. so if anyone got any ideas.. i'm glad for any input...

thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic