How to identify spring to a QOS?

How to identify spring to a QOS?

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
beejayzed
Posts: 27
Joined: 01 Aug 2007, 07:19

How to identify spring to a QOS?

Post by beejayzed »

I want to setup a qos for my lan so that I don't get ping spikes in spring.
So how can I identify spring traffic to it? Can I tell spring to always try to use a specific source port (when running as a client)?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Usually 8452 UDP is springs port. This can change if you're using holepunching though.
beejayzed
Posts: 27
Joined: 01 Aug 2007, 07:19

Post by beejayzed »

AF wrote:This can change if you're using holepunching though.
That's why I need another way. I often play games with NAT traversal.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Hmm....spring reads the sourceport from script.txt, and if it's not there it defaults to 0 and then loops until it finds a free one :?

Code: Select all

	while (bind(mySocket,(struct sockaddr *)&saMe,sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
		numTries++;
		if(numTries>10){
			closesocket(mySocket);
			throw network_error("Error binding socket as client: "+GetErrorMsg());
		}
		saMe.sin_port = htons(sourceport+numTries);
	}
...gross :P

You'll have to bug Satirik to add an option to force the source port...in the meantime, when a game starts, kill spring.exe, manually edit script.txt to add "sourceport=xxxx;" below the other connection info, and relaunch spring from the command prompt with script.txt as an argument.
Last edited by Peet on 09 Dec 2007, 07:27, edited 1 time in total.
beejayzed
Posts: 27
Joined: 01 Aug 2007, 07:19

Post by beejayzed »

Why not use a more portable language to make the hack?
Maybe I'll try to do this in python. Does it have to be in a specific location in the file, or anywhere past the first brace?
Last edited by beejayzed on 09 Dec 2007, 07:28, edited 1 time in total.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

beejayzed wrote:Why not use a more portable language to make the hack?
my VS install died to it's a moot point :P

Could be anywhere past the first brace, the tdf parser is nice and un-picky like that :)
beejayzed
Posts: 27
Joined: 01 Aug 2007, 07:19

Post by beejayzed »

Here is a python script which is meant to replace the spring executable so that the lobby runs it instead. Put the name of your executable in the execute function. I haven't tested it in windows. Does spring exist in the path in windows?
I tested a bit on my machine, played a few games, it does what it's meant to.

Code: Select all

#!/usr/bin/python

import sys
import os

port = 46235
script = ''
scriptfilelist = []
sourceportexists = 0
if len(sys.argv) > 1:
    script = sys.argv[1:]
    print type(script)
    if type(script) == list:
        script = ' '.join(script)

print sys.argv
print script
print script[-4:]

def execute():
    global script
    os.execlp('spring','spring',os.getcwd()+'/'+script)
    sys.exit()


def writenewfile():
    global port,script,scriptfilelist
    print 'Adding source port as', port, 'to script file', script 

    scriptfile = file(script, 'w')
    for i in scriptfilelist:
        scriptfile.writelines(i)
        if i[0] == '{':
            scriptfile.writelines('\tsourceport='+str(port)+';\r\n')
    scriptfile.close()

#incase input file is not .txt, a start script)
if script[-4:] != '.txt':execute()
    
scriptfile = file(script, 'r')
for i in scriptfile:
    scriptfilelist.append(i)
scriptfile.close()

for i in scriptfilelist:
    if i.find('sourceport') == 1:
        sourceportexists = 1
        print 'sourceport exists'

if sourceportexists == 0: writenewfile()

execute()
Post Reply

Return to “Help & Bugs”