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)?
How to identify spring to a QOS?
Moderator: Moderators
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 
...gross 
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.

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);
}

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.
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?
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.
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.
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()