expert's help needed with networking URGENT!!!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: expert's help needed with networking URGENT!!!

  1. #1
    Join Date
    Apr 2005
    Posts
    3

    Arrow expert's help needed with networking URGENT!!!

    im trying to convert this java applet code to c#.


    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);
    }
    catch(Exception exception)
    {
    _logout();
    txtAreaMessages.appendText("Could not Connect...");
    return;
    }
    _OOS.writeObject(this); //<<< im
    _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();


    im stuck with this line of code:
    _OOS.writeObject(this);


    what does it do?? and how i can perform the same in c#, bcoz server is same. i only need to convert the client into .net windows app.

    thanks in adv.

    waiting for a quick +ve reply soon.

    // chall3ng3r //

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    That line writes an object to a stream. The object must implement Serializable so that the output stream can transform it's fields into something that can be transported. I don't know C# so I don't know if there's anything analagous. Take a look at the Sun tutorial which will explain it a lot better than me...

    http://java.sun.com/docs/books/tutor...alization.html

  3. #3
    Join Date
    Apr 2005
    Posts
    3
    thanks, i'll take a look at it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center