Photon tcp client/ client.connect() error

I am trying to make a client in my photon to communicate to a server I have made in labview. The server works fine, but the client can’t connect to it. Here is my code:

TCPClient client;
byte server[] = {130,64,148,78};

void setup() {
    Serial.begin(9600);
    while(!Serial.available()) Particle.process();

    Serial.println("connecting...");


   if(client.connect(server,5002)){
        Serial.println("connected");
        client.write("testing\r\n");
        
    } else{
        Serial.println("connection failed");
    }
}

void loop() {
    if(client.available()){
       client.write("a\r\n");
    }
    if(!client.connected()){
        Serial.println();
        Serial.println("disconecting");
    }
}

The check for client.available() indicates data from the server is ready to be read. Instead of reading (and emptying the receive buffer), you do a client.write(). This loop will eventually break I suspect. What output are you getting from your debug messages?

There are no debug messages. The problem is that it doesn’t connect to the server in the first place, the setup function.

@pesma, in the least you should be seeing “connecting…” and possibly “connection failed” in your serial console. Do you get these?

Yes, thats exactly what I’m getting.

@pesma, have you verified that port 5002 is open in any router or firewall between the photon and the target server?

yep, they re both using the same port.