this all what i get from console
Java Plug-in 10.3.1.255
Using JRE version 1.7.0_03-b05 Java HotSpot(TM) Client VM
User home directory = D:\Documents and Settings\ali
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

Why didn't any of the printlns from your applet show on the java console? Add some more printlns to the applet to see if any part of the applet is executing.

i put print statement before the defenition of the socket and the statement appered but the statement after the defeition of the socket doesnot appered

the statement after the defeition of the socket doesnot appered

What has changed now? Before you said:

thank you for your help the print statement is now apppered

Then the printStackTrace statement must be called because of an exception at the socket statement.

One or the other MUST happen!!!

when i said the print statement appered that when i run the applet alone without displaying it on a web page

Why isn't something printing? Add more printlns to see where the code is executing.

if i put this code only the first print statement is displayed

private void button1MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // TODO add your handling code here:
        try{
             System.out.println("hello");
            // this.textField2.setText(textField1.getText());
      Socket dd=new Socket("127.0.0.1",3000);
      System.out.println("hello");
      DataInputStream c=new DataInputStream(dd.getInputStream());
      DataOutputStream c1=new DataOutputStream(dd.getOutputStream());
      c1.writeUTF("hello");
 System.out.println("yeeeeeeeeeeeeee");

}
catch(Exception et){
  et.getStackTrace();  
}
    }

All the printed messages should be unique so you know which println printed the message.
You have two printlns that print the same message.

Why do you have this statement?

et.getStackTrace();

to get the error

I've never used that method. How does your code use it?
What does your code do with the value returned by that method?

In case of a GUI you need to define another method parametres like an another instance of variable to use.. try that it will work.. honestly I never tried an UDP with TCP however it will work if you initiate a new instance for the GUI

how i can do that can you explain ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.