MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / StartClientInThread

Function StartClientInThread

tests/test_p2p.py:191–230  ·  view source on GitHub ↗
( role, local, remote, extra_args=[], stun=_DEFAULT_STUN, turn=_DEFAULT_TURN )

Source from the content-addressed store, hash-verified

189 return None
190
191def StartClientInThread( role, local, remote, extra_args=[], stun=_DEFAULT_STUN, turn=_DEFAULT_TURN ):
192 cmdline = [
193 "./test_p2p",
194 "--" + role,
195 "--identity-local", "str:"+local,
196 "--identity-remote", "str:"+remote,
197 "--signaling-server", "localhost:10000",
198 "--log", local + ".verbose.log"
199 ]
200
201 if stun is _DEFAULT_STUN:
202 cmdline += [ '--stun-server', "%s:%d,[%s]:%d" % (g_stun_ip, g_stun_port, g_stun_ipv6, g_stun_port) ]
203 elif stun is not None:
204 cmdline += [ '--stun-server', stun ]
205 # stun=None: omit --stun-server entirely (executable uses its built-in default)
206
207 if turn is _DEFAULT_TURN:
208 cmdline += [ '--turn-server', "%s:%d" % (g_stun_ip, g_stun_port) ]
209 cmdline += [ '--turn-username', _TURN_USERNAME, '--turn-password', _TURN_PASSWORD ]
210 elif turn is not None:
211 cmdline += [ '--turn-server', turn ]
212 # turn=None: omit --turn-server entirely (no relay)
213
214 if g_repeat > 1:
215 cmdline += [ '--repeat', str(g_repeat) ]
216 cmdline += extra_args
217 if g_spew_level is not None:
218 cmdline.append( '--spewlevel=' + g_spew_level )
219 if g_p2p_rendezvous_level is not None:
220 cmdline.append( '--loglevel-p2prendezvous=' + g_p2p_rendezvous_level )
221
222 env = dict( os.environ )
223 if os.name == 'nt' and not os.path.exists( 'steamnetworkingsockets.dll' ) and not os.path.exists( 'GameNetworkingSockets.dll' ):
224 bindir = os.path.abspath('../../../bin')
225 if not os.path.exists( bindir ):
226 print( "Can't find steamnetworkingsockets.dll" )
227 sys.exit(1)
228 env['PATH'] = os.path.join( bindir, 'win64' ) + ';' + os.path.join( bindir, 'win32' ) + ';' + env['PATH']
229
230 return StartProcessInThread( local, cmdline, env );
231
232# Mock network address constants -- IPv4
233# Public range: 127.0.100.x Private LANs: 127.0.X.x (X != 100)

Callers 2

ClientServerTestFunction · 0.85

Calls 2

StartProcessInThreadFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected