View unanswered posts | View active topics It is currently Thu Apr 18, 2024 11:12 pm



Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
 Beta queue cap 
Author Message
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1131
Location: Augusta, GA
Unread post Re: Beta queue cap
TWX is using TClientSocket in non-blocking mode. What I saw in testing is that I was getting a WSAEWouldBlock error code, so I've added the appropriate code for the OnWrite event where I now resend the buffer. I wasn't checking the results of the Send function, and I'm kinda surprised this hasn't shown up before now. I'm adding the code to check the results (BytesSent) and update the Buffer appropriately. I have some testing to do, but I think this will fix the problem.

I'm glad you're enjoying this Rev. It's not often we mention sockets on this forum.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Sun Sep 26, 2010 11:11 pm
Profile WWW
Gameop
User avatar

Joined: Thu Mar 08, 2001 3:00 am
Posts: 886
Location: USA
Unread post Re: Beta queue cap
ElderProphet wrote:
TWX is using TClientSocket in non-blocking mode. What I saw in testing is that I was getting a WSAEWouldBlock error code, so I've added the appropriate code for the OnWrite event where I now resend the buffer. I wasn't checking the results of the Send function, and I'm kinda surprised this hasn't shown up before now. I'm adding the code to check the results (BytesSent) and update the Buffer appropriately. I have some testing to do, but I think this will fix the problem.

I'm glad you're enjoying this Rev. It's not often we mention sockets on this forum.

sockets seem simple at first, but the devil is in the details. there are tons of corner cases. for example, what is the right thing to do when you lose your network, or when your adapter's ip address changes? how do you detect those events in your code correctly (besides trapping socket errors)? also, what ip address should your listener socket use? if your machine has multiple network adapters, which one will route the traffic to the twgs? does it matter?

i recently hired two contractors to write some code for me at work. these guys were excellent C# developers with tons of experience. however, neither one of them had ever dealt with sockets outside of very high-level canned objects that took care of everything for them. they were completely lost when i told them they would have to construct udp packets from scratch and create sockets to send them. it took over a month for me to convince them that they should bind their listener socket to 0.0.0.0 and that was only after a serious intervention with the help of other team members.

_________________
twgs : telnet://twgs.thereverend.org:5023
web : http://www.thereverend.org
games : http://www.thestardock.com/twgssearch/i ... verend.org
helper : http://svn.thereverend.org:8080/revhelper/


Sun Sep 26, 2010 11:48 pm
Profile
Site Admin
User avatar

Joined: Sun Dec 24, 2000 3:00 am
Posts: 3150
Location: USA
Unread post Re: Beta queue cap
@Singularity, SG just posted the latest version which includes an increased sockets buffer size. If you could test your scripts to see if that made a difference, I'd appreciate it. There appears to be an instability in this version and I'm looking for the cause, but hopefully you can still test this to see if I've improved anything.

_________________
John Pritchett
EIS
---
Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.


Mon Sep 27, 2010 6:27 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Beta queue cap
I tested the wsend..

Quote:
P: [++] 305 7792
P: [++] 306 21880
P: [++] 307 2076 3063 10853
P: [++] 308 22606
P: [++] 1418 26939
P: [++] 1419 20791 28607


Quote:
P: [++] 1666 16489
P: [++] 1667 21939
P: [++] 1668 858 13026 18748 20960
P: [++] 2627 5418 22420 25462
P: [++] 2628 2828 6327 7527
P: [++] 2629 5538


It's still skipping at/near the same spot. It's a quicker skip, but it's
still skipping.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Mon Sep 27, 2010 7:26 pm
Profile ICQ WWW
Site Admin
User avatar

Joined: Sun Dec 24, 2000 3:00 am
Posts: 3150
Location: USA
Unread post Re: Beta queue cap
Ok, I just verified that my test also fails on SG's server. That just shows how much this depends on characteristics of the sender, receiver and network. On a LAN I was able to see improvement with an increased buffer size, but over the network and with SG's server under load, the problem persists. I'll leave the buffer size where it is because it did improve things in my tests, but it's not going to mask this problem. I'd like to see if the efforts by Rev and EP have an effect. If their changes don't help, I'll know it's something I need to fix. For now, I'm not seeing any specific change I made to code that might have caused this to show up, but I did make some low-level changes like a new memory manager and new thread-processing system so maybe one of those changes is responsible. But again, I did see this behavior in v1.03 so it's not completely new, just more obvious. I'd also like to know if the problem shows up on any server or if it's something about SG's server.

_________________
John Pritchett
EIS
---
Help fund the TradeWars websites! If you open a hosting account with A2 Hosting, the service EIS uses for all of its sites, EIS will earn credits toward its hosting bill.


Mon Sep 27, 2010 8:09 pm
Profile WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1131
Location: Augusta, GA
Unread post Re: Beta queue cap
I've rewritten TWX's TClientSocket Send command to detect imcomplete sends, buffer the unsent portion, and retry when the OnWrite event fires. I'm treating it all as a text string, where it might be more elegant as a buffer or stream, but I believe it will work properly now for these massive sends. Sing, I'd like to get you a build to test if you're willing.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Mon Jun 27, 2011 10:31 am
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Beta queue cap
Yeh, if you just want to put it up on the svn and send me the info again, I'll can build it and test it. A current build would be sweet.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Mon Jun 27, 2011 10:53 am
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1131
Location: Augusta, GA
Unread post Re: Beta queue cap
It's on the svn: https://svn.twxscripts.com:8443/svn/mai ... y205/trunk
For read access: username is guest, no password.
Latest is revision 68.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Mon Jun 27, 2011 5:04 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Beta queue cap
Ok, compiled and attached. I get these 2 "hints" also...

[Pascal Hint] TCP.pas(585): H2164 Variable 'stream' is declared but never used in 'TModClient.Send'

[Pascal Hint] ScriptCmd.pas(1513): H2077 Value assigned to 'Delta' never used


Attachments:
TWXProxy.zip [463.02 KiB]
Downloaded 424 times

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image
Mon Jun 27, 2011 6:56 pm
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1131
Location: Augusta, GA
Unread post Re: Beta queue cap
Yeah, those hints won't affect things, but thanks. I'm interested if your huge sends succeed now. Let me know if you have a chance to test.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue Jun 28, 2011 9:58 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Beta queue cap
There's a popup "Unable to connect to ..." that comes up when the server can't connect. Can you disable that? It kills relog scripts.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Wed Jun 29, 2011 5:26 am
Profile ICQ WWW
Display posts from previous:  Sort by  
Reply to topic   [ 26 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.