Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Networking & Multiplayer / Re: Sending Object through TCP/IP... on: 2003-04-26 23:18:53
OK...so, I've managed to get the Deck successfully deserialized...that's the good news...

the bad news...is that I had to be using the same version of the JVM on both sides (precisely as all of you had implied)...and that's not taking advantage of the platform independency that java is used for...SO...I will be taking the advice of mr. blahblahblahh and using the M/V/C technique...

I guess i had to learn the lesson of swing serialization the hard way...

thanx for helping me out, fellas...I appreciate it...

Russ
2  Game Development / Networking & Multiplayer / Re: Sending Object through TCP/IP... on: 2003-04-25 02:36:30
I am using the same classes...

I think i might be able to narrow it down, however...

it says the exception is coming from javax.swing.Jcomponent...a Deck object is basically a subclass of a Vector (perfectly serializable, btw)...the Deck contains any number of Card objects...Cards are basically just subclasses of a JButton...now, a JButton is a JComponent, so I'm pretty sure that the problem lies within that class...however, I'm not sure how serialization works with hierarchy...

in order to make the classes compatible, i have set the serialVersionUID in both the Deck class and the Card class...

(...Deck...)
static final long serialVersionUID = -8436333800348538015L;

(...Card...)
static final long serialVersionUID = -8293881053128968132L;

as you can see, those SVUIDs aren't either of the ones described in the exception...

does anyone have a clue as to what I should do to fix this problem???...has anyone run into this before?...

Thanx for any input...

Russ

3  Game Development / Networking & Multiplayer / Sending Object through TCP/IP... on: 2003-04-23 20:40:08
I am trying to send a Deck object that I have created by subclassing the Vector class through a TCP/IP Connection...I'm not sure if i'm doing this correctly, however...the problem isn't getting the deck SENT, i don't think, but receiving it correctly is the problem...

The Client side code is as follows...

InetAddress server = InetAddress.getByName("hippo");
                 int port = 22222;
                 
                 Socket socket = new Socket(server, port);
                 
                 System.out.println("Connected to server...attempting to send deck");
                 
                 ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
                 oos.writeObject(deck);
                 System.out.println("DeckSent");
                 oos.flush();
                 oos.close();
socket.close();

(I'm catching everything necessary...)

Please don't poke too much fun at the code, i'm just beginning this TCP/IP stuff ;-)

anyways, i'm sure that the message is getting to the server...because the connection is made fine...

server code is as follows...

int servPort = 22222;
             ServerSocket serverSocket = new ServerSocket(servPort);
             
             while(true){
                   Socket inSocket = serverSocket.accept();
                   
                   ObjectInputStream ois = new ObjectInputStream(inSocket.getInputStream());
                   
                   Object possibleDeck = ois.readObject();
                       System.out.println("Checking for Instance");
                       if(possibleDeck instanceof Deck){
                             System.out.println("It's a Deck");
                             deck = (Deck)possibleDeck;                        
                             
                             System.out.println("Deck Loaded..."      );
                       }
                       else
                             System.out.println("It's not a deck");
                       ois.close();
                       serverSocket.close();      
                 }

it gives the error message (which i will display in a sec) when it reaches the line:  "Object possibleDeck = ois.readObject();"

The error message is as follows...

java.io.InvalidClassException: javax.swing.JComponent; local class incompatible:
stream classdesc serialVersionUID = 4775608949283930591, local class serialVers
ionUID = -7908749299918704233

I can't seem to fix it...it might help to know if where the problem is rising...is it the WAY that i'm sending the object (basically, CAN I DO IT THAT WAY????)...or does it have to do with something else?...

any help is appreciated...even suggestions on how to fix it (sample code is *always* welcome...) ...

if i'm not sending the object in the correct manner, what is the best (easiest, even) to send one object from one machine to another?...

Thanx for any help....

Russ
4  Game Development / Networking & Multiplayer / 2 Player M:TG Online Card Game... on: 2003-04-15 01:52:45
I'm developing an online card game for Magic:  The Gathering that will, at first, be only a 2 Player game.  I am proficient in Java, but the Socket Programming is where I'm the most ignorant...

Firstly, I want this to be as live action as possible (basically, if I move a card on the table, then the other player sees me moving the card)...I don't think this type of animation is too demanding, so I'm planning on using TCP/IP.  

My questions is, once the connection between the two players is made (when connecting, one serving as the server, and the other the client), am I going to be able to have each of the players be able to send and receive messages simultaneously?  And if so, how do I do that?

I guess my ignorance of SocketProgramming is showing through now, but I have this notion that in order to receive something, you have to be listening for that particular someting.  Is it possible to have the GUI running on ONE thread, and when a message is needed to be sent, I can send that on ANOTHER thread?  While simultaneously listening on yet ANOTHER thread for information coming from the other client (in case he plays/moves a card)?

Once again, I'm new to this socket programming thing...and any input will be helpful.  Also, if I'm completely missing something, or if you think i'm looking too much into this, please, your other suggestions are welcome.  

Thanx...

LordWilson
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (45 views)
2014-09-23 14:38:19

radar3301 (27 views)
2014-09-21 23:33:17

BurntPizza (63 views)
2014-09-21 02:42:18

BurntPizza (33 views)
2014-09-21 01:30:30

moogie (41 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!