Sending strings to a server..

publicclass sendToServerimplements ActionListener{

publicstaticvoid main(String args[]){

new sendToServer();

}

public sendToServer(){

JFrame mainFrame =new JFrame("Sending to server test..");

mainFrame.setSize(new Dimension(300, 300);

Container frameCon = mainFrame.getContentPane();

JButton send =new JButton("Send");

frameCon.add(send);

}

publicvoid actionPerformed(ActionEvent e){

JButton b = (JButton) e.getSource();

if(b.getText().equals("Send")){

Socket socket =new Socket("localhost", 9412);

OutputStream os = socket.getOutputStream();

PrintWriter pw =new PrintWriter(os);

pw.write("Yo");

}

}

Im trying to send a string to a server..any help?

[1677 byte] By [Shadow1222a] at [2007-11-27 10:00:54]
# 1
Read the "Custom Networking" tutorial: http://java.sun.com/docs/books/tutorial/
camickra at 2007-7-13 0:32:28 > top of Java-index,Desktop,Core GUI APIs...