Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (511)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Chanel ID  (Read 3742 times)
0 Members and 1 Guest are viewing this topic.
Offline harry@dayfamilyweb

Junior Duke





« Posted 2006-04-06 08:00:14 »

how do you get the channel ID when you create the chanel doing this
ST1.openChannel("chat");
or this
SelectableChannel SC2;
or
SocketChannel SC;
if your only suosed to use one which one do you use Huh Grin Tongue
 
PS are
SimTask and NIOConnection ment to work together
+ how do you set the port to lisen at  Embarrassed Huh

PPS how do you register a user or get User ID
Offline stenkarl

Innocent Bystander




Java games rock!


« Reply #1 - Posted 2006-04-06 14:38:15 »

Quote
how do you get the channel ID when you create the chanel doing this
ST1.openChannel("chat");
or this
SelectableChannel SC2;
or
SocketChannel SC;
if your only suosed to use one which one do you use Huh Grin Tongue

On the server side, you receive a Channel ID as the return value from SimTask.openChannel(channelName).  You can use this Channel ID to reference the channel in the future (but not across server reboots).  On the client side, you simply reference channels by name -- no IDs are known to the client.

You shouldn't ever have to use the raw NIO classes such as SocketChannel.  If you need to open an artibrary connection on a remote server, use the Raw Socket Manager via SimTask (i.e. SimTask.openSocket, sendRawSocketData, closeSocket, etc.)

Quote
PS are
SimTask and NIOConnection ment to work together

You shouldn't have to worry about NIOConnection.  SimTask is your server-side view of the world.

Quote
+ how do you set the port to lisen at

In your deployment descriptor (deploy.xml for most of the examples) one of the parameter names is "port".  Also, if you are using the canned FakeDiscovery.xml, specify the port here as well.

Quote
PPS how do you register a user or get User ID

There should be a server-side class signed up as the SimUserListener for the application.   When a user connects, the UserID is passed to the SimUserListener.userJoined call back.  In most of the examples there is a "Boot" class that handles user logins/logouts.  The Chat Test is an excellent example of most of the common idioms for user connection.

Hope that helps.
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2006-04-06 18:10:36 »

Quote
how do you get the channel ID when you create the chanel doing this
ST1.openChannel("chat");
or this
SelectableChannel SC2;
or
SocketChannel SC;
if your only suosed to use one which one do you use Huh Grin Tongue

On the server side, you receive a Channel ID as the return value from SimTask.openChannel(channelName).  You can use this Channel ID to reference the channel in the future (but not across server reboots).  On the client side, you simply reference channels by name -- no IDs are known to the client.

Actually thats not quite correct.  Omn he client, you recieve a ClientChannel object in your joinedChannel callback.
Until you recevieve this, the channel is not ready for your use.

Quote
You shouldn't ever have to use the raw NIO classes such as SocketChannel.  If you need to open an artibrary connection on a remote server, use the Raw Socket Manager via SimTask (i.e. SimTask.openSocket, sendRawSocketData, closeSocket, etc.)

More then that, you CANT use them ina  GLO because they arent serializable.  (There are other good logical reasons too but thats a key one.)


Quote
PS are
SimTask and NIOConnection ment to work together

NIOConnection is only useful as a base class fro stack extension.

It shouldnt even be IN the docs you have now.  Is it?




Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline harry@dayfamilyweb

Junior Duke





« Reply #3 - Posted 2006-04-06 20:22:38 »

NIOconection is in the server API docs!!! Shocked
Offline harry@dayfamilyweb

Junior Duke





« Reply #4 - Posted 2006-04-06 20:36:35 »

Quote
+ how do you set the port to lisen at


Quote
PPS how do you register a user or get User ID

There should be a server-side class signed up as the SimUserListener for the application. When a user connects, the UserID is passed to the SimUserListener.userJoined call back. In most of the examples there is a "Boot" class that handles user logins/logouts. The Chat Test is an excellent example of most of the common idioms for user connection.

Hope that helps.
i cannot create a userLisener when i do i get this erro

C:\Program Files\HSim\Cat101\src\cat101\Main.java:39: addUserListener(com.sun.gi.logic.GLOReference<? extends com.sun.gi.logic.SimUserListener>) in com.sun.gi.logic.SimTask cannot be applied to (com.sun.gi.logic.SimUserListener)
        ST1.addUserListener(UserListen);     
1 error

and this is my code
 SimTask ST1;
ST1.addUserListener(UserListen);
private final SimUserListener UserListen = new SimUserListener() {
        public void userJoined(UserID uid, Subject subject) {
           
        }

        public void userLeft(UserID uid) {
        }
       
   };
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2006-04-06 21:23:25 »

You are trying to pass a GLO directly to a SImTask method.

You need to pass a GLOReference to the Simtask. 
in general all GLOs shoudl be referenced through GLOReferences.

Take a look at the SwordWorld code and tutorial. I discuss this explicitly.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline harry@dayfamilyweb

Junior Duke





« Reply #6 - Posted 2006-04-06 22:03:04 »

thanks i had a look a the batelboard code and changes some things  in my own code 1. i added a boot method and so on now it compiles well so far all it dose is figurout the user iD and open 3 chanels but it dose not run i thinks this is my fault by movig it the lib folder and edited password.txt and SGS_config files and so on here is my deploy.xml files is it corect?? Huh Tongue Undecided<?xml version="1.0" encoding="UTF-8" ?>
- <!--

  -->
- <GAMEAPP gamename="Cat101">
  <GLEAPP bootclass="cat101.Main" classpathURL="file:Cat101.jar" />
- <USERMANAGER serverclass="com.sun.gi.comm.users.server.impl.TCPIPUserManager" reconnect_key_ttl="10">
  <PARAMETER tag="host" value="127.0.0.1" />
  <PARAMETER tag="port" value="4444" />
- <VALIDATOR moduleclass="com.sun.gi.comm.users.validation.impl.FlatFileUserValidator">
  <PARAMETER tag="password_file_url" value="file:password.txt" />
  </VALIDATOR>
  </USERMANAGER>
  </GAMEAPP>
Offline Jeff

JGO Coder




Got any cats?


« Reply #7 - Posted 2006-04-06 22:31:20 »

What did you put in lib?

(1) You need to put an entry in SGS-apps/conf that points to the directory where you put that deployment XML
(2) You need to make sure the port you are telling ti to use  in the deployment XMl is not in use by someone else.
(3) You need to put your jar in the same directory as the deployment XML.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline harry@dayfamilyweb

Junior Duke





« Reply #8 - Posted 2006-04-07 05:28:05 »

What did you put in lib?

(1) You need to put an entry in SGS-apps/conf that points to the directory where you put that deployment XML
(2) You need to make sure the port you are telling ti to use in the deployment XMl is not in use by someone else.
(3) You need to put your jar in the same directory as the deployment XML.

1 check
2. how
3 check
Offline Jeff

JGO Coder




Got any cats?


« Reply #9 - Posted 2006-04-07 20:11:08 »

What did you put in lib?

(1) You need to put an entry in SGS-apps/conf that points to the directory where you put that deployment XML
(2) You need to make sure the port you are telling ti to use in the deployment XMl is not in use by someone else.
(3) You need to put your jar in the same directory as the deployment XML.

1 check
2. how
3 check

How: 
(1)try netstat and see what ports are listed as "listening" when not running the server.
(2) when you run the server watch for exceptions in the log when it starts up
(3) COmment out everything in SGS-app.conf except your app to make sure you arnt conflicting with another app in the same server

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #10 - Posted 2006-04-07 20:12:19 »

Btw
"does not run" is not a very useful erro report.

What is it explicitly doing that you dont expect or not doing that  you do expect? 

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline harry@dayfamilyweb

Junior Duke





« Reply #11 - Posted 2006-04-07 20:36:35 »

in cmd.exe
>java -jar SunGameServer
Unable to access jarfile SunGameServer
Offline Jeff

JGO Coder




Got any cats?


« Reply #12 - Posted 2006-04-07 21:35:05 »

the filename is SunGameServer.jar

There should be a shell script right there that runs it as well.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline harry@dayfamilyweb

Junior Duke





« Reply #13 - Posted 2006-04-07 21:44:01 »

how you run shell script on winXP
Offline harry@dayfamilyweb

Junior Duke





« Reply #14 - Posted 2006-04-07 21:45:49 »

and i still get the same message when i d0 that  Cry Cry Cry
Offline Jeff

JGO Coder




Got any cats?


« Reply #15 - Posted 2006-04-07 21:56:45 »

SHow me what you are typing and what the response is. Also what directory are you in when you do this?

The shell script would either have to be run  under Cygwin or re-written as a bat file for it to work in windows

You should  be typing java -jar SunGameServer.jar

If you type dir you should see:

bin
lib
release
examples
etc
doc
README
SunGameServer.jar
SGSClient.jar

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline harry@dayfamilyweb

Junior Duke





« Reply #16 - Posted 2006-04-08 03:56:08 »

how do you rewrite the shell file(dose not work wen i open it in notepad and save it as a.bat file)
in cmd.exe
>java -jar SunGameServer
Unable to access jarfile SunGameServer
that is what i am typing (i tried SunGameServer.jar instead of just SunGameServer as well) but i was told to run it from the release file
Offline kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #17 - Posted 2006-04-08 04:50:09 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
@echo off

REM Command-line options for SGS:
REM
REM    -I <url>    Provide a URL to the Install-spec which lists
REM               the game apps to be hosted on this backend
REM
REM   -V          Verbose startup
REM
REM   -C          (deprecated) Clear the datastore on startup.
REM                It is safer to remove the persistant_store
REM                directory manually.
REM

set JAVA=c:\windows\system32

echo on
%JAVA%\java -jar SunGameServer.jar -V -I file:SGS-apps.conf %1%


This is how I ended up translating the .sh into a .bat. Hope it helps.

Kev

Offline harry@dayfamilyweb

Junior Duke





« Reply #18 - Posted 2006-04-08 06:04:00 »

thanks Cool
Offline Jeff

JGO Coder




Got any cats?


« Reply #19 - Posted 2006-04-08 17:31:17 »

how do you rewrite the shell file(dose not work wen i open it in notepad and save it as a.bat file)
in cmd.exe
>java -jar SunGameServer
Unable to access jarfile SunGameServer
that is what i am typing (i tried SunGameServer.jar instead of just SunGameServer as well) but i was told to run it from the release file


Actually, in closer inspection , we're both wrong.

you want to be in release/server when you run it/

A dir shoudl look like this:

apps
lib
SunGameServer.jar
startSGS.sh
startDiscovery.sh
SGS-apps.conf
passwd.txt

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline harry@dayfamilyweb

Junior Duke





« Reply #20 - Posted 2006-04-08 21:23:25 »

that works cool ps i used the startSGS.bat and it works
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (32 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (58 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!