hi all,
im a c# developer 'n new to java applets,
my client have a server and a web java applet that connects to server using socket
i've got a task to create a c# windows application to do same as the applet.
im just confused, when i saw the applet code, it connects to server, and sends itself to the server!!!
here's the code, can anyone plz help me what's actually happening...
Code:
try
{
to_server = new Socket(getCodeBase().getHost(), port_of_server);
_OOS = new ObjectOutputStream(to_server.getOutputStream());
is = new DataInputStream(new BufferedInputStream(to_server.getInputStream()));
os = new PrintStream(new BufferedOutputStream(to_server.getOutputStream(), 1024), false);
txtAreaMessages.setText("");
txtMessage.setEnabled(true);
txtMessage.setText("");
}
catch(Exception exception)
{
_logout();
txtAreaMessages.appendText("Could not Connect...");
return;
}
// THIS IS THE CODE WHERE IM CONFUSED!!!
_OOS.writeObject(this);
_OOS.flush();
os.print(1);
os.flush();
ClientNew clientnew = new ClientNew(is, os, txtAreaMessages);
clientnew.start();
btnLogin.setEnabled(false);
txtLoginName.setEnabled(false);
btnSend.setEnabled(true);
btnMobMessage.setEnabled(true);
ch_thread = new Thread(this, "abc");
ch_thread.start();
alll is well, but what's with ObjectOutputStream, and why its sending (this) to server??
im asking this question here because i wanna learn it as well :D
it'll be really great help if someone can tell me same to do in c#
i cannot do anthing with the server, i've to convert this to c#
regards,
// chall3ng3r //
----------------------------
you cannot change th truth,
but truth can change you
- unknown
----------------------------