Here is my simple tetrinet testing code.
all seem to be ok, the psp connect well to the server.
i can start game from another client.
see the game on the psp.
BUT
if someone can tell me why the psp down the connection to the server after 2-3 minutes ??
thx.
Code: Select all
white = Color.new(255, 255, 255)
offscreen = Image.createEmpty(480, 272)
offscreen:clear(Color.new(0, 0, 0))
y = 0
x = 0
function graphicsPrint(text)
for i = 1, string.len(text) do
char = string.sub(text, i, i)
if char == "ÿ" then
y = y + 8
x = 0
elseif char ~= "\r" then
offscreen:print(x, y, char, white)
x = x + 8
end
end
screen:blit(0, 0, offscreen)
screen.waitVblankStart()
screen.flip()
end
Wlan.init()
configs = Wlan.getConnectionConfigs()
Wlan.useConnectionConfig(0)
socket, error = Socket.connect("82.67.130.62", 31457) --- connexion to my tetrinet server
while not socket:isConnected() do System.sleep(100) end
bytesSent = socket:send("A226BA16B122A429A43F88CDDC76DC06448990F81E7E80\n") -- precalculated client info for testing (nick, etC..)
while true do
buffer = socket:recv()
if string.len(buffer) > 0 then break end
screen.waitVblankStart()
end
buffer =""
bytesSent = socket:send("team 2 \n")
while true do
buffer = socket:recv()
if string.len(buffer) > 0 then
graphicsPrint(buffer)
end
if Controls.read():start() then break end
screen.waitVblankStart()
end
Wlan.term()