hello friends

my question is how do i do the socket connections between a client side & server side using applets??

actually this is used for chat coding.

can i get a code for that for ref.
Who is Participating?
From: Jod        Date: Wednesday, November 17 1999 - 10:37AM CST       

Some IRC (java) clients that are free - with source code: 
Working clients (no source):
(working versions you could download and decompile or just use for testing...) 

All these are chat code in java applets.

U will get good handle
more Info:

java how-to IO part 1

better use HTTP
Reads From A URL : example

HTTP Trace Applet

Firewall Access in Java Applets

Working with a Server-Side Application

Using a Server to Work Around Security Restrictions

Frequently Asked Questions - Java Security 
What Applets Can and Can't Do 
Security Restrictions 

Creating Signed, Persistent Java Applets 

CGI at server side

Netscape FAQ:
How do I access Servlets or CGI programs from Java?
Using the QUERY method (i.e. the calling parameters are encoded in the URL), it is quite easy:
         URLConnection connect ( new URL("http:\\me\") ).getConnection();
         PrintStream ps = new PrintStream(connect.getOutputStream());
         connection.setdoOutput(true);    // defaults to false
         ps.close();             // very important to close before reading
         InputStream is = new PrintStream(connect.getInputStream());
         // read the results

Note: URLConnection() is an abstract class whose sub-class is usually supplied by the environment (browser).
Some browsers allow output without calling "doOutput(true)", which violates the Java spec and may be confusing
when code works one place and not another.

Talk to a CGI/Servlet

U can use servlet at server side

What are servlets?

  Servlets are server-side Java applications, as opposed to
  client-side applets or standalone applications. While
  servlets are compatible with many different types of servers,
  typically they are used in web servers, as a replacement for
  CGI scripts or Active-Server Pages (ASP).

  Java servlets offer many advantages over other forms of
  server-side processing. Apart from the obvious (they are
  written in the Java programming language, a big plus after
  all), servlet based applications are far easier to write
  than CGI scripts. There's no need to write code for parsing
  HTTP request parameters, as this code is provided by the
  javax.servlet.http package. You have access to the entire
  Java API, with no networking restrictions (making servlets
  far more attractive than applets). There are also performance
  increases over CGI scripts, as servlets persist over time,
  and do not create a new process for every connection.

Purple Servlet FAQ

The Servlet home page on the Javasoft website

Servlet Essentials by Stefan Zeiger

Paul Flavin's Servlet Resources page

Applet and Servlet Communication

How can my applet communicate with my servlet?
It's pretty straightforward. You can use the and classes to open a standard HTTP connection to the web server. The server then passes this information to the servlet in the normal way. Basically, the applet pretends to be a web browser, and the servlet doesn't know the difference. (Of course, you can write a servlet that is only called from your applet, in which case it *does* know the difference...)

For more detail, you can see the Sun Web Server FAQ Questions C8 and C9. Also, Chad Darby has an article with source code on the subject. And Netscape DevEdge Online has a similar article - Applet-to-Servlet Communication for Enterprise Applications skip to the "Communication Tactics" section to get to the good part.

Applet-to-Servlet Communication for Enterprise Applications

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

s_butalaAuthor Commented:
dear ravindra

the sites which u have mentioned does'not contain the chat code.
can u cut paste for me?
ravindra76 changed the proposed answer to a comment
s_butalaAuthor Commented:
dear ravidra
where are the comments??
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.