I already have the code that gets the peers in a given peer group, so i want to put up a simple interface that allows a user to choose which peer to connect to, and then bring up a simple chat app. I just need some time to put it together, but i'm not expecting any complications.
I also download the latest BABS release and it looks pretty sweet, good job Dev.
« previous next » |
Networking (Read 153080 times)

#17
Administrator
Shining Spammer


Posts: 1,208
Logged
#18


Posts: 230
Logged
It's all right, i'm pretty good at cleaning up and organizing code. I'm glad i can use your engine because, though i'm very confortable with the language, i have zero experience in dealing with graphics in Java, so it saves me the time of going through the API.
By the way, here is a P2P chess game built in Java using the JXTA protocol:
http://chess.jxta.org/
If they can do it, we can do it.
By the way, here is a P2P chess game built in Java using the JXTA protocol:
http://chess.jxta.org/
If they can do it, we can do it.


#19


Posts: 230
Logged
Seeing as peers will be represented by a username, and in order to guarantee username uniqueness, i'll have to implement a login system.
I was thinking of having the application authenticate at the Shining Source, this way YOB members won't have to register to test the game and i won't have to build a login/registration system.
Ty is it possible for you to write a script that takes in a username and password (via POST), tries to login and prints true/false if the login succeeds/fails? This would be as secure as a regular browser login.
I was thinking of having the application authenticate at the Shining Source, this way YOB members won't have to register to test the game and i won't have to build a login/registration system.
Ty is it possible for you to write a script that takes in a username and password (via POST), tries to login and prints true/false if the login succeeds/fails? This would be as secure as a regular browser login.

#22
Administrator
Shining Sideburns

Posts: 837
Logged
Done.
This page takes two POST vars - "username" and "password", and will verify them. It will either return "true", or "false" followed by a line break and an error message. Both fields should be sent plain text (i.e. the password should not be encrypted), but this can change at a later date should you wish.
Any problems, let me know.
This page takes two POST vars - "username" and "password", and will verify them. It will either return "true", or "false" followed by a line break and an error message. Both fields should be sent plain text (i.e. the password should not be encrypted), but this can change at a later date should you wish.
Any problems, let me know.

#23


Posts: 230
Logged
Great, i'll put it to use soon. I suffered a setback when i found out that the same application can't be running both a client and a server, hence it can't both be listening for connections and attempting to connect to some peer. To solve this peers will choose to either connect to waiting peers or wait for peers to connect, but this can be changed at any time.
I had to recode some stuff, but i think it was for the best since now i have my own custom client/server sockets, i made them really easy to use:
ServerSocket:
void listen()
void send(String msg)
ClientSocket:
void connect(Peer)
void send(String msg)
I also created the interface SocketListener:
void onConnect()
void onReceive(String data)
(I even worked out a handshake protocol so that each peer can be certain that the other peer is running the right application)
The above works very nicely so a chat app is really easy to make. The things that i need to get done before we have a P2P Chat app are:
. Figure out how to send Post data with a socket.
. Create a login interface
. Create an interface that shows waiting peers, and allows users to choose one to connect to
. Create a chat interface
. Compile the program.
I had to recode some stuff, but i think it was for the best since now i have my own custom client/server sockets, i made them really easy to use:
ServerSocket:
void listen()
void send(String msg)
ClientSocket:
void connect(Peer)
void send(String msg)
I also created the interface SocketListener:
void onConnect()
void onReceive(String data)
(I even worked out a handshake protocol so that each peer can be certain that the other peer is running the right application)
The above works very nicely so a chat app is really easy to make. The things that i need to get done before we have a P2P Chat app are:
. Figure out how to send Post data with a socket.

. Create a login interface
. Create an interface that shows waiting peers, and allows users to choose one to connect to
. Create a chat interface
. Compile the program.

#24


Posts: 230
Logged
Of the above all that is left to do is:
. Create the chat interface.
. Compile the program.
If everything goes smoothly i'll have this ready either today or tomorrow.
. Create the chat interface.
. Compile the program.
If everything goes smoothly i'll have this ready either today or tomorrow.

#25


Posts: 230
Logged
I got it working. I'm going to wait to release a demo because there's some bugs i need to fix and some behaviors i want to add (connection timeout for example).
The chat worked fine between my computer and my brother's.
I have two screenshots of it here (the interface was roughly put together):


By the way, i created a user DemoUser with password "demo" just for testing purposes, in case your wondering who that is.
Ty edit: Made post pretty
The chat worked fine between my computer and my brother's.
I have two screenshots of it here (the interface was roughly put together):


By the way, i created a user DemoUser with password "demo" just for testing purposes, in case your wondering who that is.

Ty edit: Made post pretty


#26
Administrator
Shining Spammer

Posts: 1,129
Logged
That's so cool!
Good stuff!
One new thing I've thought about, especially with testing - is to time sync everyone, and give an idea of what's possible.
Let's talk about time in GMT, since I'm not sure what zone you're in.
So my day starts around 2200GMT and ends 1400GMT
I can take time out of the beginning, middle OR end of the day usually just not all three
I can also stay up late or wake early if it's important, and just move my stuff around cos I really want to see this go somewhere.
Well done, once again, I'm getting excited!
Good stuff!
One new thing I've thought about, especially with testing - is to time sync everyone, and give an idea of what's possible.
Let's talk about time in GMT, since I'm not sure what zone you're in.
So my day starts around 2200GMT and ends 1400GMT
I can take time out of the beginning, middle OR end of the day usually just not all three

I can also stay up late or wake early if it's important, and just move my stuff around cos I really want to see this go somewhere.

Well done, once again, I'm getting excited!
~Elvenfyre

#28


Posts: 230
Logged
I've been trying to eliminate some of the bugs in the prgoram. I just fixed a rough one that was causing the program to deadlock. Apparently if you use threads with Swing components there's a chance the program might deadlock.
An interesting thing came out of this. There was another bug that prevented the chat window from scrolling down whenever text was appended if the chat window did not have the focus. I later found out that this is a bug in Java 1.5.0 (so not my fault), and that there's no current workaround for it. Here's the link to the bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5003402
The interesting thing is that the code that i used to fix the bug that was causing the deadlock also fixed the scrolling bug. I posted a comment in the link above with the code i used, to let other developers know.
But there's still some other stuff to fix.
An interesting thing came out of this. There was another bug that prevented the chat window from scrolling down whenever text was appended if the chat window did not have the focus. I later found out that this is a bug in Java 1.5.0 (so not my fault), and that there's no current workaround for it. Here's the link to the bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5003402
The interesting thing is that the code that i used to fix the bug that was causing the deadlock also fixed the scrolling bug. I posted a comment in the link above with the code i used, to let other developers know.
But there's still some other stuff to fix.

#29


Posts: 230
Logged
I've gotten to a state right now where everything is running pretty smoothly. The chat app supports multiple connections, it can detect when a connection is remotely closed, it can restart a connection, etc.
I'm thinking of releasing it, once it's finished, as the "Shining Source Instant Messenger"
.
I need to think of a proper interface. I think i'll just model it after some popular instant messenger's interface like Yahoo, AIM... etc.
By the way, i know it's not really necessary to have a Shining Source messenger since everybody here probably already has one they can use, it's just the groundwork for a multiplayer game.
I'm thinking of releasing it, once it's finished, as the "Shining Source Instant Messenger"

I need to think of a proper interface. I think i'll just model it after some popular instant messenger's interface like Yahoo, AIM... etc.

By the way, i know it's not really necessary to have a Shining Source messenger since everybody here probably already has one they can use, it's just the groundwork for a multiplayer game.
