Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Noop

 
Post new topic   Reply to topic Printable version
 View previous topic  Subgame idea Post :: Post arena config  View next topic  
Author Message
Cerium
Server Help Squatter


Age:43
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Tue Jul 26, 2005 3:04 am    Post subject: Noop Reply to topic Reply with quote

Is there any way for a client to request that the keep alive (NOOP) message be sent/not sent periodicly by the server?
_________________
There are 7 user(s) ignoring me right now.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Jul 26, 2005 3:12 am    Post subject: Reply to topic Reply with quote

Looking at the 140 code it seems the server sends a NOOP to a client if it hasn't sent anything s2c for 3 minutes. So you could send a command to the server every 2 minutes and maybe hide the response from the user, but I don't think this is what you are looking for.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Cerium
Server Help Squatter


Age:43
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Tue Jul 26, 2005 3:34 am    Post subject: Reply to topic Reply with quote

I see.

Yeah, im kinda looking for some kinda message so the user can control if/when thats sent (kinda like the keep alive packet in the SS protocol).

Basicly, the Socket object in java isnt very friendly for designing timeout checks, unless im willing to let it my inputstream block for an ungodly long time, then throw an exception (which im not).
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Tue Jul 26, 2005 4:30 am    Post subject: Reply to topic Reply with quote

You don't have to send a command, just send a NOOP yourself. It will be correctly ignored.

What's wrong with doing nothing special, and letting the server send NOOPs? You also might want to have an option in your client to send them periodically, to deal with crappy NAT devices that incorrectly drop open TCP connections.

I haven't used sockets in java, but there must be a way to set up your control flow so that you both receive data from the network when it comes in, and also can be woken up for timers. Perhaps you need to look at the asynchronous i/o libraries.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Cerium
Server Help Squatter


Age:43
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Tue Jul 26, 2005 6:44 am    Post subject: Reply to topic Reply with quote

async operations arent the problem here, I just was wondering if there was a way to tell the server to send them, since the docs seemed to hint that NOOP may not be sent often, if at all.

Sockets in java are easy to work with, its just the timeout checks which arent friendly. Im no pro, but the only way I know of is to set the timeout in the socket (via setSoTimeout), then tell your inputstream to .read, which will block until it gets data, or until the timeout has been reached, which results in an exception.

Ill probably restructure my receiver to use that method instead of my hack method now, and hope no outside sources decide to close the connection =)
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Jul 26, 2005 9:04 am    Post subject: Reply to topic Reply with quote

Can't you just check the type of the exception?
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cerium
Server Help Squatter


Age:43
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Tue Jul 26, 2005 11:52 am    Post subject: Reply to topic Reply with quote

Yup. SocketTimeoutException.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Wed Jul 27, 2005 3:16 am    Post subject: Reply to topic Reply with quote

Grelminar wrote:
You don't have to send a command, just send a NOOP yourself. It will be correctly ignored.

Code: Show/Hide
         /* send noop if we haven't sent anything to this client for
          * 3 minutes */
         if (TICK_DIFF(gtc, cli->lastsendtime) > 18000)
            sp_send(cli, "NOOP");

The only place cli->lastsendtime gets modified is when the player connects and gets created or in do_sp_write() which gets called when something is sent s2c.
Code: Show/Hide
int do_sp_write(sp_conn *conn)
{
   Link *l = LLGetHead(&conn->outbufs);

   if (l && l->data)
   {
...
      conn->lastsendtime = current_ticks();
   }

   return 0;
}
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Wed Jul 27, 2005 3:43 am    Post subject: Reply to topic Reply with quote

Yes, that looks correct. The server will send a NOOP every three minutes, if no other traffic has been sent. It's not configurable, although it wouldn't be hard to make it configurable, if there's a good reason for it.

Now that I think about it, it should reset the timer (not "lastsendtime", but use another timer) for any c2s traffic as well, since this being tcp, c2s traffic implies packets flowing s2c also. The point is just to hack around broken NAT devices, so any packets at all are sufficient.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 41 page(s) served in previous 5 minutes.

phpBB Created this page in 0.425598 seconds : 33 queries executed (92.9%): GZIP compression disabled