• Post Reply Bookmark Topic Watch Topic
  • New Topic

applet to IIS via sockets

 
Christophe Lee
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me if IIS by default accepts java socket connections? How can I send information from an applet to the IIS server? Thanks.
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your applet could just do a HTTP GET or POST to send data to the IIS server.
Have a look at the API for HttpURLConnection.
 
Christophe Lee
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your suggestion, by itself, does not work (I think). I do not think applets, even though downloaded from the server by the client, have the privilege to write files directly to the server. I believe you still need something on the server side to talk to the applet and that something will write the file on the server side.
Am I right here?
If I'm using IIS, how can I achieve writing a file on it? I'm using httpURLConnection to establish a connection, but there is still no way to write directly to the server (or is there?).
Thanks.
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are correct that applet can't directly write a file on the server.
You would send data from the applet via HTTP (either a GET or a POST), and have the corresponding ASP (or whatever is listening on the other end) take the data from the request and write a file.
 
Christophe Lee
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I'm using IIS, how would you suggest I handle the connection from the applet?
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most simple approach would be just to use Active Server Pages (ASP) listening at the server side, this is Microsoft's version of JSP, except ASP looks alot like visual basic.
Just have the ASP take the request from the applet (in JSP speak, something like, String myData = request.getParameter("myData"); ), and then write it to a file using whatever file manipulation object ASP has to offer.
Sorry I am not an ASP expert, but I am sure you can find that info easily.
The other approach (mentioned in the Advanced Java Forum) was to use RMI, up to you how you want to do it.
James.
 
Christophe Lee
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey James,
Thanks for the reply. I think I will stick with Java and use RMI (instead of VB with ASP). However, I am still having a few doubts. They are addressed in the advanced forum's room. You can click here to go to the discussion.
I would really really appreciate any feedback you might have. Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!