Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - EiTkoCaT

Pages: [1] 2
1
Network / Apache and mail server - delay of UDP?
« on: September 18, 2011, 05:37:53 pm »
I'm running Apache2 and mail server, and in the same server a game server that gets and sends UDP and TCP packets. I have a big delay on the packets. When I'm running on a different server on the same place and also in my computer, no delay at all. Is the apache2 and the mail makes the dekay? Why?

2
Network / UDP Packet is never "Done" on Linux?
« on: September 16, 2011, 11:10:55 am »
Hey,

As I've learned in http://www.sfml-dev.org/forum/viewtopic.php?t=5852 I need to have one boost thread for the UDP packets. And I did it. On my computer it works perfect, but on my Ubuntu 10.04 it always returns that the socket is not ready. It's not a problem with the client and I'm sure about that. The socket is not blocking, also on blocking it's not working. What's the problem here? Here's some code:

Code: [Select]
void UDPUser () {
int countIt = 0;
sf::SocketUDP Socket;
if (!Socket.Bind(2435))
{
   // Error...
cout << "ERROR 97" << endl;

}

//Client.SetBlocking( false );
Socket.SetBlocking( false );
cout << "listen" << endl;

while(true) {
char Buffer[128];
std::size_t Received;
sf::IPAddress Sender;
unsigned short Port;
if (Socket.Receive(Buffer, sizeof(Buffer), Received, Sender, Port) != sf::Socket::Done)
{
// Error...
cout << "error 107" << endl;

//return;
} else {
cout << "gpt" << endl;
}
}
}

3
Network / Best Way To Handle Thousands of UDP packets in a second
« on: September 13, 2011, 02:49:13 pm »
Hey,


I need to handle from each client 30 packets per second. I have like 500 clients connected in the same time. I need to get a packet, process it and give an answer. What would be the best way to do that? Selector? SFML Threads? Boost Threads?

Thanks.

4
Network / UDP are delayed. Linux settings?
« on: September 10, 2011, 08:26:47 pm »
I'm having some lags with my server running Ubuntu 10.04 on my UDP packets. What should I do to change the settings set for the UDP packets? I think the problem is there.

On my /proc/sys/net/ipv4/udp_mem I have 137088   182784   274176
udp_rmem_min: 4096
udp_wmem_min: 4096


/proc/sys/net/core/rmem_max - 131071
/proc/sys/net/core/rmem_default - 124928

/proc/sys/net/core/wmem_max - 131071
/proc/sys/net/core/wmem_default - 124928

5
Network / Checking client ping
« on: August 21, 2011, 07:03:50 pm »
Hey,

Can I check the client's ping with the server? You know, this millie second thing.

Thanks.

6
Network / Problem when client is diconnecting
« on: August 19, 2011, 12:47:26 pm »
Hey,

My server is using SFML c++ for TCP connections. If a user closes the client program, the server needs to know that he is now disconnected. Whenever I close the program in the client, the server does says that the client disconnected. But if the client lost connection or something, and did disconnected from the server, the server still sees him as connected. Why is that happening? My check is always:
status = (Client.Receive(MessageLivea, sizeof(MessageLivea), Receiveda));
if ( status  != sf::Socket::Done)
{
cout << "disonnected" << endl;
} else ....

7
Network / Multiple UDP Clients
« on: July 09, 2011, 04:32:27 pm »
Hey,

So there is this code to listen to any UDP client, but is there a way to do Socket.Receive with an exact IP?


Thanks.

8
Network / Nagle-Like Problem
« on: July 07, 2011, 12:02:37 pm »
so I have this real-time game, with a C++ sever with using SFML library , and client using asyncsocket, also disables nagle. I'm sending 30 packets every 1 second. There is no problem sending from the client to the server, but when sending from the server to the clients, some of the packets are migrating. For example, if I'm sending "a" and "b" in completly different packets, the client reads it as "ab". It's happens just once a time, but it makes a real problem in the game.

So what should I do? How can I solve that? Maybe it's something in the server? Maybe OS settings?

To be clear: I AM NOT using nagle but I still have this problem.

9
Network / Making my C++ software work on Ubuntu Server
« on: June 01, 2011, 02:28:02 am »
Hey,

OK, so I've finished coding my C++ app on my PC, I wanna run it in my VPS. I have a clean Ubuntu VPS.

The problem is that hell, I don't have idea how to do that, I only know how to work with Windows and Mac. Never worked with servers or anything like that. I'm using MongoDB so I've installed it, then I've wrote:
apt-get build-dep libsfml
and it's all OK installed.

BUT, how can I download to there the SFML library? As you say in the tutorial: "Then, to actually compile the SFML libraries and samples, you must download and install the full SDK. Go to the SFML-x.y directory, and type the following commands:". How can I Go to the SFML-x.y if... I don't have it? Or maybe I do, I just don't know where?


Thanks!

10
Network / "Endless"-getting-messages problem
« on: May 25, 2011, 11:47:45 pm »
Hey,

so I have this connections I want to get from them always messages and just write them. The thing is that I'm talking about 20 TCP messages per second per client. And there gonna be a lot of clients.

Any way, I have a problem... With my 1 client connected, it's drops me an error in the 3rd message I send. My code is maybe weird, that's right - but that's how I thought. So every time the client sends something like:
3TR 1 name var1 var2\0
and I need the server to split the string every " " so I use string to vector split by boost. Here's my full code:

Code: [Select]
while (CountinewWithPlayer)
{

std::size_t Receiveda = 0;
sf::Socket::Status status;
char MessageLivea[256];
status = (Client.Receive(MessageLivea, sizeof(MessageLivea), Receiveda));
if ( status  == sf::Socket::Disconnected || status  == sf::Socket::Error)
{
cout << "Disconnected" << connectedClients << endl;
CountinewWithPlayer = 0;
} else if ( status  == sf::Socket::Done )
{
cout << MessageLivea << endl;
std::vector<std::string> current_stringLivea;
boost::split(current_stringLivea, MessageLivea, boost::is_any_of(" "));
cout << current_stringLivea[0] << current_stringLivea[1] << current_stringLivea[2] << current_stringLivea[3] << endl;
}
}


My problem:
Quote
Debug Assertion Failed!
 
Program: …
File: c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector
Line: 932
 
Expression: vector subscript out of range
 
For information on how your program can cause an assertion
Failure, see the Visual C++ documentation on asserts.


What to do?
Thanks.

11
System / How should I use threads in here...
« on: December 25, 2010, 02:41:44 pm »
Hey, I have this
Code: [Select]
#include <iostream>
#include <sstream>
#include <string>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include "client/dbclient.h"
#include "Mongo.cpp"
#pragma comment( lib, "mongoclient" )

std::vector<sf::SocketTCP> Users;
std::vector<sf::IPAddress> UsersIP;
sf::SocketTCP Server;
sf::SocketTCP Client;
sf::IPAddress ClientAddress;

int connectedClients = 0;
mongo::DBClientConnection c;
bool server_running;

bool LoginSeccedd;
void serverTCP(void* UserData);
sf::Thread ThreadTCP(&serverTCP);

using namespace std;


void startUserrt(sf::SocketTCP Client, sf::IPAddress ClientAddress) {

/*Users.push_back(Client);
UsersIP.push_back(ClientAddress);

connectedClients++;

for (int i=connectedClients; i<connectedClients;i++)
{
cout << ClientAddress[connectedClients] << endl;
}*/

char Message[256];
std::size_t Received;
if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done)
return;
// Show the message

string stringAll, str3, str4;
stringAll = Message;
size_t found;
size_t total = 0;
string current_string[3];

for (int i=0;i<3;i++)
{
cout << &Message[total] << endl;
found = strlen(&Message[total]);
current_string[i] = &Message[total];
total += found + 1;
}

if (current_string[0] == "7L")
{
// Login
cout << "Login requst" << endl;
mongo::BSONObjBuilder query;
query.append( "email" , current_string[1] ).append( "password", current_string[2] );
mongo::BSONObj res = c.findOne( "test.users" , query.obj() );
string userID = res["email"];
cout << userID << endl;
// session_userEmail = userID;
// session_userID = res["_id"];
if (userID == "EOO")
{
char ToSend2[] = "8L 0 not-found\0";
if (Client.Send(ToSend2, sizeof(ToSend2)) != sf::Socket::Done)
return;
cout << ToSend2 << endl;
}
else
{
char ToSend2[] = "8L 1 1\0";
if (Client.Send(ToSend2, sizeof(ToSend2)) != sf::Socket::Done)
return;
cout << ToSend2 << endl;
LoginSeccedd = true;
}
}
else if (current_string[0] == "7R")
{
// Register
cout << "Register requst" << endl;
   mongo::BSONObjBuilder query;
query.append( "email" , current_string[1] ).append( "password", current_string[2] );
mongo::BSONObj res = c.findOne( "test.users" , query.obj() );
string userID = res["email"];
cout << userID << endl;
if (userID == "EOO")
{
char ToSend2[] = "8R 1\0";
// INSERT USER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!***********************************************************************
if (Client.Send(ToSend2, sizeof(ToSend2)) != sf::Socket::Done)
return;
cout << ToSend2 << endl;
LoginSeccedd = true;
}
else
{
char ToSend2[] = "8R 0 3\0";
if (Client.Send(ToSend2, sizeof(ToSend2)) != sf::Socket::Done)
return;
cout << ToSend2 << endl;
}
}
else
{
cout << "Unknow Request" << endl;
}


if (LoginSeccedd = true)
{
char Message[256];
std::size_t Received;
if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done)
return;
cout << Message << endl;
if (Message == "7MM")
{
// Load Main Menu - send character information
/*string ToSend2 = "8MM";
mongo::BSONObjBuilder query;
query.append( "user_id" , session_userID );

auto_ptr<DBClientCursor> cursor =
c.query("test.characters", query.obj() );
while( cursor->more() ) {
BSONObj p = cursor->next();
cout << p["name"] << endl;
ToSend2 += p["name"];
}
cout << ToSend2 << endl;*/

}
else if (Message == "7CC")
{

}

}
}


void serverTCP(void* UserData) {
while (server_running)
{
// Wait for a connection
   if (Server.Accept(Client, &ClientAddress) != sf::Socket::Done)
return;
cout << "Client connected : " << ClientAddress << std::endl;
startUserrt(Client, ClientAddress);

/*User *current;
current = new User;
current->startUserrt(Client);*/
}
}




void startServer() {
server_running = true;
   if (!Server.Listen(2435))
return;

cout << "Server is listening to port " << 2435 << ", waiting for connections... " << std::endl;
ThreadTCP.Launch();
}

int main()
{
 c.connect("localhost"); //"192.168.58.1");
cout << "connected ok" << endl;
startServer();

    // Wait until the user presses 'enter' key
    std::cout << "Press enter to exit..." << std::endl;
    std::cin.ignore(10000, '\n');
    std::cin.ignore(10000, '\n');

    return EXIT_SUCCESS;

}


This is a server where number of clients logging into it and sending messages. My problem here is not the networking, it's the threads. When a client connect it's not a problem, but it somewhy can't handle more than one client. You see, after a client loged in and the server sends him a message, the client needs to send a message "7MM". But for the check, I'm not sending it. Here's the problem, if client A connects and loged in good-> not sending 7MM and user B also trying to connect, he can't. He have to wait until the function startUserrt of user A will finish itself. So, what do I have to do if I want to make it work for multiple clients? Thanks![/code]

12
Network / Handling Multiple TCP Connections
« on: December 18, 2010, 11:51:27 pm »
Hey,

I have a problem handling multiple TCP connections on a C++ app that uses SFML library to send and read TCP messages.

Let's say I need to have 5 TCP connections to the server once (can be also 10K, just for example..). When client 1 sends a message, the server process it and then should send a message to clients 2-5, let's say in that case that he should send the same message.
How can I do that?

Thanks!

13
Network / Wired Problem
« on: November 20, 2010, 08:33:30 pm »
Hello,

I'm using SFML to get messages from clients. I'm sending a msg, for exemple: "Schogini Systems", but somewhy, I get in the server this "Schogini Systems╠╠╠╠▌óea└÷^♦]ז╖".

When I'm sending MSGS from a SFML client it's all OK.

WTF?

14
Network / Using SSL
« on: November 11, 2010, 09:50:08 pm »
Hey,

I'd like to add a SSL secure to the connections. Is it possible? If yes, how to? I'm using UDP and TCP, don't thing there needs to be other detail :)

Thanks!

15
Network / UDP Server - Handling multiple connections
« on: September 16, 2010, 07:34:14 pm »
Hey,

I tried to use that http://www.sfml-dev.org/tutorials/1.6/network-selector.php but I can't understand how to use it in UDP. I secceed to create sockets (learned via the example that comes with SFML), but I want multiple clients, and also, I couldn;t understant why the program always closed after the first socket it gets. Anyway, if anyone can tell me how can I handle multiple clients with multiple messgaes from every client in UDP,

thanks!

Pages: [1] 2