DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links