Jump to content
  • Advertisement

Exiled

Member
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

105 Neutral

About Exiled

  • Rank
    Member
  1. Argh! So many SDL_net problems! This one is probably the most important one. I have a basic chat working. However, I'm not sure how to have clients remotely connect. I have port forwarded on my server port (9001), and replaced "localhost" with my external IP address. However, the clients are still unable to connect. If you need any code, just ask. Have you guys had the same problem? Thanks in advance. -Exiled
  2. "I do not analysed the traffic".... You have no direct point, Telnet is developed by Microsoft. Both my client and Telnet disconnect when the server receives something. This means the fault is with the server; it cannot be with the client.
  3. It is not a guess; it happened with my game client as well.
  4. I am using Telnet as a test client. Therefore, the code problem is with the server.
  5. I already know the client is disconnecting, the server can easily handle more connections.
  6. Hmm. That makes sense - any ideas on how I can fix it?
  7. I'm aware I just made a post about SDL_net; however, I have run into a new problem. Packets are sending and getting received. However, when the server receives the data, the client simply disconnects. The SDLNet_TCP_Recv(...); function returns -1. I cannot find the error, for SDLNet_GetError(); isn't working for me(it returns nothing). Has anybody run into this problem before? My code is below. //Receiving Code result = SDLNet_CheckSockets(player_sockSet, 0); //loop through each client for(int client = 0; client < maxPlayers; client++) { //check the socket for activity int clientSocketActivity = SDLNet_SocketReady(players[client].sock); if(players[client].connected == true && clientSocketActivity > 0) { //attempt to read from the socket. //non-positive return values indicate error int bytesRecv = SDLNet_TCP_Recv(players[client].sock, msg, 256); if(bytesRecv > 0) { //display the result stringstream ss; ss << "Received " << bytesRecv << " bytes from client " << client << "!"; consoleOut(ss.str()); } else { //there was an error stringstream ss; ss << "Player " << client << " has disconnected."; consoleOut(ss.str()); players[client].connected = false; connectedPlayers--; //disconnect the socket } } } Please excuse the bad indenting, it's because of copy + paste. Thanks in advance! -Ex
  8. I check if player_sockSet has data available. A sock set is exactly what it states: a socket set. I have a socket set of all the player sockets... I check it every loop of the for loop. [/quote] My bad, I read it as "player_socket" not "player_sockSet" [/quote] Ah, it's all good.
  9. consoleOut(); is just a function I made for outputting stuff to a console I made with graphics rather than a console window. I'm actually using Allegro 5 for graphics and SDL_net for networking.
  10. I check if player_sockSet has data available. A sock set is exactly what it states: a socket set. I have a socket set of all the player sockets... I check it every loop of the for loop.
  11. I've been working on a server for a game I'm working on. I'm having some trouble with sending and receiving packets... Here's my sending code... SDLNet_TCP_Send(sock, "EX_DC", 6); /* *** this is placed at the end of int main(), to determine a disconnect. (EX_DC = Exiled(prefix), Disconnect(action). *** */ ...and here's my receiving code. for(int x = 0; x < connectedPlayers; x++) { int ready = SDLNet_CheckSockets(player_sockSet, 0); if(ready != -1) { result = SDLNet_TCP_Recv(players[x].sock, msg, 256); consoleOut("Received data!"); } } //This is placed inside of a for loop that loops through an array of clients. When I send the data, the server doesn't print anything to the console. What am I doing wrong?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!