Connection issue

Whenever I go to join a server it just says connecting: (the server ip address). I’ve closed steam and tried to connect which fixes the connecting problem but I am still unable to connect to any steam servers because it says steam isn’t working (and lets be real here, the only servers worth playing on are the ones that require steam). I have a legit copy of the game but it is not through steam which I’m concluding is the problem. I can’t seem to figure out how to fix this. Any suggestions besides just closing out of steam?