• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to execute a TCP/IP command from Java

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm not sure if I've included this in the correct topic area or not.
What I am trying to do is to call update a database using FileMaker.
What I need to do is to call the following http request.
http://www.mytest.com/mwhandler/FMPro?-db=mytest&-lay=cgi&-forma
t=mwregsucc.txt&-error=mwregerr.txt&username=Max1&password=fsdkjf879dfz
isu7748765&-new
However If I did this in a servlet then i would be overwriting my HttpServletResponse object which i don't think I can do. Also I don't actually want to redirect to this link from my jsp pages, I just want to call it somehow from my servlet. Do you know if there is a way of doing this, or of carrying out my task. Of somewhow calling the command above without actually redirecting to this link?
Any ideas on this would be greatly appreciated.
[ December 18, 2002: Message edited by: Fergus Red ]
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at the class java.net.URLConnection
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpURLConnection uconn=(HttpURLConnection)dest.openConnection();
but, it seems setRequestProperty(..) is not working.
it remains the same.
is there anything I have do before I use the HttpURLConnection?
thank you in advance.
 
Fergus Red
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got it working using the following
java.net.URLConnection conn = new java.net.URL(urlInsert).openConnection();
InputStreamReader inp = new InputStreamReader(conn.getInputStream());

Thanks for the help again.
 
Screaming fools! It's nothing more than a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic