Results 1 to 2 of 2
  1. #1
    skandalouz is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default sending object through network/socket

    Hey,
    I'm running into some problems with a program I have to do for a school project. I've been working on a program which is something like a very easy game/database thingy. It runs a GUI, which reads from a file which characters are available and reads the stats from those characters. I can change, modify or add characters and then save to the file.
    The next step is to change this into a network application. My teacher handed out some example program, but it doesnt even run so thats no help.
    I've found some example about sockets on the internet which did work on strings, but I'm trying to send objects. I used serializable on one of my objects to try, but it didnt work. second thing I noticed, if I check in the TestServer class is the incoming object is instanceof String, it only responses to every second message. Are my Objects being sent and received?
    The code my teacher's example show some interfaces, is this necessary and if so, what is their pupose here?
    I've attached my code, so if anyone could give it a look I'd appreciate it very much.
    The Gui3 is the working Gui, the TestClient and TestServer both have a gui for testing purposes to send messages across.
    Regards,
    Skandalouz
    Attached Files Attached Files

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Look at the api for ObjectOutputStream and ObjectInputStream. It's easiest to create a container object that holds the other objects that need to be sent, so everything goes at once.

Similar Threads

  1. Sending a key over network
    By cst in forum Networking
    Replies: 0
    Last Post: 11-04-2009, 01:19 PM
  2. sending file over network
    By qwerty in forum Networking
    Replies: 6
    Last Post: 04-25-2009, 01:55 AM
  3. Sending a file through socket
    By sureshkumarcs88 in forum Networking
    Replies: 2
    Last Post: 03-14-2009, 07:32 AM
  4. socket programing outside the network
    By Omarero in forum Networking
    Replies: 4
    Last Post: 02-16-2009, 06:15 AM
  5. Sending .GIF files over the network
    By nadia in forum Networking
    Replies: 8
    Last Post: 12-30-2008, 11:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •