Unable to connect to TCPServer

Hello,

I wrote a program using the TCPServer and a client in .Net to connect to it. Worked fine.
Now 2 weeks later I run the same program and it does not work anymore…?
Now I cannot connect to this tcpserver anymore using .Net, putty,… or anything.
I saw other stuff changed, like the switch from the Spark namespace to the Particle namespace.

Is there a change in this functionality or is there a bug anyone else has problems with?

I retried with this code, still does not work…

TCPClient client;
TCPServer server = TCPServer(15000);

void setup() 
{
    server.begin();
    Particle.publish("** IP: " + WiFi.localIP().toString());
}

void loop() 
{
   if (client.connected()) 
   {
        Particle.publish("Connected");
        while (client.available()) 
        {
            Particle.publish("Echo");
            server.write(client.read());
        }
    } 
    else 
    {
        Particle.publish("Available");
        client = server.available();
        Particle.publish("After available");
    }
}

Thanks,

Joris

It did turn out to be my firewall… Sorry everybody, I dont know how this suddenly became a problem, but I should have tested this better.
I’m going to shutdown the pc and get a scotch…

Bye!

1 Like

I have been spending another long evening on this and there does seem to be a problem.
When I run a TCPServer on the Photon and try to connect to it via .Net this does not always work. Changing the firewall has no effect, I even tested it when turned off.
When I run a listener in .Net and connect to it using a TCPClient on the Photon, this always works. And after connecting in this way, the other direction works too (TCPServer on the Photon and connecting to it via .Net). But only for about 10 minutes and then this stops working again.

As I said, I dont think this is my firewall giving the problem.

As a workaround, I am exposing a webmethod to invoke the Photon to connect to my .Net program and this runs without problems. But if anyone else is having this problem, I would be interested to know.

Regards,

Joris

Yes , I tried tcpserver and didn’t get it to work reliably too.
But the tcpclient is now one of parts of the photon which just works over and over again without fault , I hope soon we can add i2c to that list.