Author Topic: TCPObject listen server help :(  (Read 1905 times)

i'm trying to make a TCPObject listen and it seems to be behaving in a goofy manner

i've never tried this before and i can't tell what i'm doin wrong



if i make a TCPObject like so

Code: [Select]
new TCPObject(h);
and make it listen on port 5576

Code: [Select]
h.listen(5576); //also tried h.listen("localhost:5576"); in case dump told me a fibby
then define a simple onConnectRequest method like so

Code: [Select]
function h::onConnectRequest(%this, %addr, %id)
{
   %c = new TCPObject(g, %id);
   echo(%a TAB %i TAB %c);
   echo("ya");
}

here's what absolutely does happen:

-any client i try to connect will report a successful connection
if i try in python
Code: [Select]
import socket
a = socket.socket()
a.connect(('localhost',5576))

nothing appears to go wrong; i can get the peer name and it will try to send and receive if i tell it to

if i try in torquescript
Code: [Select]
new TCPObject(j);
function j::onConnectorwhatever(%this)
{
   echo("woo");
}
j.connect("localhost:5576");
it'll tell me "woo" and nothing appears to throw a fit if i try to communicate

-if i try to send anything to the server it will give the "Got bad connected receive event." error thing
from what i can tell, this is solved from it actually working and creating the client socket to respond, but..

here's what absolutely does not happen

-when the clients attempt to connect to the server (and supposedly successfully do so?), it does not appear to even call onConnectRequest
the debug echos do not fire off and g does not get created. i have tried other possible variations (onConnectionRequest, etc) and those also do not work

-any indication from the server that stuff is going on, other than when i attempt to send while connected



i have looked at other scripts and they appear to do very similar things, but clearly i'm messing up somewhere
i know i don't have the entire connection response handled but the function isn't even called at this point

doing a trace shows no activity when a connection begins or when data is buttsent

Check out Truce's webserver, here: http://pastebin.com/s5n3mVYR

Make sure that your firewall isn't blocking it.

yeah i was just looking at that

i can't see what basic parts i got wrong though. the firewall shouldn't matter on a local connection, should it?

i did actually just try on my VPS and it worked so gg i guess ha
« Last Edit: September 13, 2014, 08:17:44 PM by otto-san »

i did actually just try on my VPS and it worked so gg i guess ha

Haha hopefully you didn't spend hours trying to diagnose your code.

jesus christ it's always the last thing you think

even though i know that by now it still gets me every time

I couldn't even begin to guess what this is all about xD

So much more to learn

jesus christ it's always the last thing you think

Well your not gonna find the solution then keep on looking for it, are you?