void PlayerCmd_getIP(int a1) { ENTITY* ent = game->getEntity(a1); if(ent) { char* ip = getClientIP(a1); Script_AddString(ip); } }
//-------------------------------------------------------------- void ofxMatrixNetworkServer::draw(int xRefPos, int yRefPos){ ofSetHexColor(0xDDDDDD); ofDrawBitmapString("Matrix SERVER connect on port: "+ofToString(getPort()), xRefPos, yRefPos); //ofSetHexColor(0x000000); //ofRect(10, 60, ofGetWidth()-24, ofGetHeight() - 65 - 15); ofSetHexColor(0xDDDDDD); //for each connected client lets get the data being sent and lets print it to the screen for(unsigned int i = 0; i < (unsigned int)getLastID(); i++){ if( !isClientConnected(i) )continue; //give each client its own color ofSetColor(255 - i*30, 255 - i * 20, 100 + i*40); //calculate where to draw the text int xPos = xRefPos + 5; int yPos = yRefPos + 15 + (12 * i * 4); //get the ip and port of the client string port = ofToString( getClientPort(i) ); string ip = getClientIP(i); string info = "client "+ofToString(i)+" -connected from "+ip+" on port: "+port; //draw the info text and the received text bellow it ofDrawBitmapString(info, xPos, yPos); //ofDrawBitmapString(storeText[i], 25, yPos + 10); } }
void ServerNetworkHandler::consoleUI(int pSocket){ if (_consoleMode){ std::string userInfo = ServerOperations::getInfo(_sessionID); //OBTENER PATH std::string currentPath = Tokenizer::getCommandSpace(userInfo, 1); std::string user = Tokenizer::getCommandSpace(userInfo, 2); std::string message = getClientIP() + std::string("@") + user + std::string(":~") + currentPath + std::string(">> "); outMessage(message, pSocket); } }
void writeFromClientLog (struct sockaddr_in echoClntAddr, int clntSock) { pthread_mutex_lock(&lockFile); fp = fopen("bitacora.txt", "a"); fprintf(fp, "%s\tConexion exitosa con el cliente %s a traves del socket %d\n", getTime(), getClientIP(echoClntAddr), clntSock); fclose(fp); pthread_mutex_unlock(&lockFile); }