Exchanging data between Java applet and server

I have a client Java applet, which needs to exchange data with its server (implemented in C++). Initially, we used sockets for that purpose, but with the spread of various firewalls this mechanism has become virtually impossible – it’s hard to ask all your web users to open a particular port to make the applet work. Is there a more reliable method for applet-to-server data exchange?

My data consists mainly of text strings and large image binary buffers.
LVL 1
olegspAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
CEHJCommented:
Can you use a serv;et instead? Or maybe CGI script?
0
 
TimYatesCommented:
If you can run a servlet on the server, then Applet-> servlet communication isn't too hard (and it will go over port 80)
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
TimYatesCommented:
0
 
objectsCommented:
You could use port 80 (and http tunnelling if required) to get thru most firewalls.
Whatever method you use is more than likely going to need a port.
0
 
TimYatesCommented:
hehe :-)
0
 
TimYatesCommented:
http://jdj.sys-con.com/read/36044.htm

shows the use of an ObjectOutputStream to serialize java objects between an applet and a servlet...
0
 
olegspAuthor Commented:
Thanks for the feedback. Mainly, you suggest Java servlets (and I am really new to them), but my server is written in C++ (Visual C++), so I need some C++ solution on the server side. Any ideas?

Another related question. Let's say, on my server computer, I am running my C++ server, and Apache (as a web server) - this is my classical environment. Apache works at port 80, which is usually open in any firewall. Can I make my C++ server work at the same port, talking to my applet?
0
 
TimYatesConnect With a Mentor Commented:
No, you can only have 1 thing per port, so you'd have to either write a CGI-script which talks to your C++ server:

    Applet ->port80-> Apache CGI-BIN ->portwhatever-> C++ server

The servlet way would require you to add Tomcat to your Apache install, then do:

    Applet ->port80-> Apache/Tomcat Servlet -> portwhatever -> C++ server

Tim.
0
 
TimYatesCommented:
You can write CGI scripts in C++, and you should be able to read the data sent to it on the stdin stream...

This is outside my realm of knowledge though...all I could give you are google links... :-(

Tim
0
 
objectsCommented:
> so I need some C++ solution on the server side. Any ideas?

Same principles, you need something listening on port 80 that passes the request on to your C++ server.
0
 
aozarovCommented:
>> so I need some C++ solution on the server side. Any ideas?
SOAP?

>> Same principles, you need something listening on port 80 that passes the request on to your C++ server.
Adding to that: when passing data thru port 80 many firewalls will reject non HTML based content (which makes
soap an even more attractive option).
0
All Courses

From novice to tech pro — start learning today.