Search the Community
Showing results for tags 'socket'.
-
Hi, Is possible to get client port from received UDP message from server Unigine socket ? Currently getPort from Unigine Socket function return server side port which was initialised at server side by open (Stream) function. But I need to get client port, from client which actually send message. As workaround I use native winsock recvfrom function to get client port at server socket. But it would be more apprieciate to get this data from Unigine API. Cheers, Jan
-
Hi, It is possible to send data to specified client by Socket class (via UDP: SOCKET_DGRAM)? I have server and connected to it 5 clients and I want to send just one message for specified client for e.g. numbered 3. Do I can do it with Socket class or I should write my own implementation ? Thank's in advance, Jan
-
Hi there could it be, that the UnigineSocket.h file is missing in the 2.2.1 release? I can't find it anywhere in the release and due to the documentation it should be there. Kind regards, Renato
-
[SOLVED] Some issues with websocket server in Unigine beta2
a.bouazaoui posted a topic in Networking
Hi, I use the webserver class found in portangeles demo, but in beta2 there is disconnection when the web page at client side receiving data from unigineScript. Also, i updated buffer to blob class, Is there other migration to be done? when i received data, the server close the connection (op_code ==8) // close connection if(op_code == 8) { //log.error("close connection op_code == 8\n"); socket.close(); return ""; } thanks. server.h -
Socket client; int init() { PlayerSpectator camera = new PlayerSpectator(); camera.setPosition(Vec3(2.0f,0.0f,1.5f)); camera.setDirection(Vec3(-1.0f,0.0f,-0.5f)); engine.game.setPlayer(camera); client= new Socket(SOCKET_STREAM); int c=client.open("127.0.0.1",6000); log.message(" server open------------%d \n",c); // success c=client.connect(); string red=client.readLine(); log.message("===================== server: %s \n",red); thread("ddfor",client); return 1; } void ddfor(Socket cc) { while(1){ // connect is 0 and open is 1 log.message("isconnect %d isopen %d\n",cc.connect(),cc.isOpened()); int r=cc.recv(1024); cc.printf("test"); // success /* add this string temp=cc.readLine(); !!!!! collapse */ log.message(" from ser: %d \n",r); wait; } } I do not know how to read from server 。 just read is Failure
-
Hi, I´m developing one application that connects to a nodejs server using socket class. The send part works perfectly but the read part has a problem... I´m trying to read the stream every second, but when the stream is empty (the server has nothing to send me) , the read operation takes 5 seconds... (read timeout?) Is there any way to know if the stream has data? (In Qt sockets you have a signal that indicates data ready to read) Thanks, David