Can perl do this...

Member
Posts: 277
Joined: 2004.10
Post: #1
I was told that perl (Mike told me Smile) is run off your server...

So can I get IP addresses with perl and see if
poeple are connected to my server (website) using perl?

And see if poeple disconnected.

(Why?)

Well I was trying to make a login/logout for a game I've been
thinking about...
(top secret, sorry, can't tell you what the game is)

(Don't worry Carlos I'll get Gigiapede done Grin)

I can use PHP,
but if the app freezez the computer the user will still be logged in...
(with this game it would mess up aton of other poeples games)
even though there not on the web.
(meaning poeple will try to network to a fake (not who they think it is) game/computer)

So can Perl see if somebody is connected to the server,
and see if this somebody IP is NOT connected to there server anymore.

I just want to know if Perl can know if xxx.xxx.xxx.xx is connected or not.
(IP address will be recorded by PHP or Perl when somebody connects to the server)

Global warming is caused by hobos and mooses
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
HTTP connections to webservers are pretty transient, so I don't know what use this would be to you, even if it were possible (which I doubt very much it is).

What is possibly possible is finding recent visitors (say, within the last couple of minutes).
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #3
When the user connects to the server, something (perl) is suppost to log them in,
when the user disconnects the something (perl) is suppost to log them out,
or they can say to the perl "Log out" The thing I didn't mention is I want there IP stored while
there logged-in then another game can log on and find other games logged-in.
(to start a network connection)

my only other choice is to write an application for the server. (linux Sad)
AND, it would cost bare-minumum $70-80 a year and $300 (every hour, 1-3 hours) for damages (YIKES!!!)

I can do everything except the logout with something like PHP
I just can't take the chance of a freezy computer...
(I would have to delete the user from the log-in files, so they could login again)

Anything else I could think of would be a security risk. Sad

Global warming is caused by hobos and mooses
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
Couldn't you just have the game refresh the connection every 30 seconds or so? And if a game hasn't reported in after a minute, bounce them?
Quote this message in a reply
Member
Posts: 75
Joined: 2002.04
Post: #5
Perl can't do anything PHP can't do (in this regard). Like OSC said, HTTP relies on stateless connections... you never know when people stop looking at your site. All you can do is timeout sessions: if a user is inactive for a certain amount of time, then have your sever log them out automatically. That will guard against frozen computers and users who forget to click the logout button.

Chris Burkhardt
Quote this message in a reply
Member
Posts: 75
Joined: 2002.04
Post: #6
Oh, if this is not a web-based game then you aren't limited to HTTP. Choose a protocol which maintains the state of a connection, then your sever will know when a client has disconnected (like the 30-second refresh suggested by Fenris). If you aren't using HTTP, then I'd wager you can find a more suitable language than perl to write your server in. What language are you coding your game in? Writing the server with the same might make sense.

Chris Burkhardt
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #7
Gooooooooooood Grin Grin Grin

(Should I do it in PHP then?)

Ok,
How fast should an internet connection be, and
what should the max amount of players be?

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 75
Joined: 2002.04
Post: #8
(I've edited my post above -- I wouldn't use PHP or Perl; C is nice and fast and powerful enough to create implementations of lots of network protocols)

I've never written a multiplayer/networked game, so I don't know how many players you can expect to be able to play at a decent pace... I imagine it depends on how much information each client needs to store and communicate about it's state and the state of all the other clients.

Chris Burkhardt
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #9
Me Wrote:my only other choice is to write an application for the server. (linux )
AND, it would cost bare-minumum $70-80 a year and $300 (every hour, 1-3 hours) for damages (YIKES!!!)

Chris Wrote:What language are you coding your game in? Writing the server with the same might make sense.

Uh, all I want is a IP finder for my game.
(the server's static IP or DNS make a good place to hand them out)
I can't code linux... (unless it's REALLY simple (using a cross-platform laguage (BSD sockets))

And it would COST A LOT to do that. (and if there is a bug *...shiver...*)

I should do it in PHP or Perl (I like what Fenris said) because it's free (yay).

*IF* I can do what Fenris said in PHP then all I have to write is a servant,
a script that does what I need... (one for each game that's online)

I've decided that the games will have a join/host that you can invite everybody or just
certain poeple...
they will send a network message to all the games logged in (or just the "certain poeple")

also, I'm going to make it a 1 minute standerd for the refresh and a 30sec refresh rate...
(so slow or busy computers have 30secs extra)
when the game refreshes it will also (if it's not in a game) get the logged-in page again...

The game will have a name and password when the user wants to login they click...
Play with members,

When they loggout the user clicks...
Main menu, (the game will log you out automaticly Grin)

so all you have to do is go to the prefs if you want to change who you loggin as.

Poeple will send names and passwords to me and I'll put them in the membership part,
the game will also be kiddie safe (no bad names or talkboard)

All the networking stuff on the server CANNOT be code it must be
PHP,Perl, or/and CGI.
Now the signup page will be in html using formmail (CGI something).

The server will only store IP's for the game to use to network to another game.

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #10
Ok, as long as you don't tell anybody.
the game is going to be a "Souls in the System" clone with the story changed. Grin
(full screen)
and each game will be responsible for "its" objects collision detection.
when an object hits another networks object I'll send a "hit" message.
Other than the normaly sending "its" objects location,
that should be all.


I think I'll make the min speed about 40bps.
I think that would make the player amount under 8 and over 2. (including yourself)
Theres only going to be about 20bytes per message.

I still have to learn the networking (other than the few apps I've tryed and telnet)
then there is the PHP/Perl that I have to learn...
(I read the entire Beej tutorial on BSD sockets just haven't tested and coded all of it)

Cool

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #11
Ok, all I need now is the static IP of my server and the information on how to connect
(so that the php document (or perl) will activate)
and I'll be all set Grin Grin Grin

THANKS EVERYBODY.

Global warming is caused by hobos and mooses
Quote this message in a reply
Post Reply