sockets

how to use java sockets to connect to an online server

此生再无相见时 提交于 2021-02-05 05:54:22
问题 I have spent some time learning Java and in doing so have built myself a rather complex game. My game is a desktop ran swing app which after play results in a score value that gets entered onto a leaderboard. The game is pretty much complete, except a few security mechanisms. At first I never intended to have my game connected to the net as the phrase 'networking' has always put me off. Now that my game has slowly developed, it has actually turned out far better than I had imagined which has

Java, how manage threads to read socket (websocket)?

瘦欲@ 提交于 2021-02-04 22:00:11
问题 I have a WebSocket server. my server create a new thread for handle a new connection.the thread is live until websocket break. my problem: for 1_000_000 connections i need 1_000_000 threads. how i can handle many websockets by a thread? without wait? ServerSocket server; private ExecutorService executor = new ThreadPoolExecutor(1_000_000 , 1_000_000 , 7, TimeUnit.SECONDS, queue, threadFactory); try { server = new ServerSocket(port); } catch (IOException e) {} while (true) { Socket client =

Java, how manage threads to read socket (websocket)?

僤鯓⒐⒋嵵緔 提交于 2021-02-04 21:59:36
问题 I have a WebSocket server. my server create a new thread for handle a new connection.the thread is live until websocket break. my problem: for 1_000_000 connections i need 1_000_000 threads. how i can handle many websockets by a thread? without wait? ServerSocket server; private ExecutorService executor = new ThreadPoolExecutor(1_000_000 , 1_000_000 , 7, TimeUnit.SECONDS, queue, threadFactory); try { server = new ServerSocket(port); } catch (IOException e) {} while (true) { Socket client =

Java, how manage threads to read socket (websocket)?

时光怂恿深爱的人放手 提交于 2021-02-04 21:57:27
问题 I have a WebSocket server. my server create a new thread for handle a new connection.the thread is live until websocket break. my problem: for 1_000_000 connections i need 1_000_000 threads. how i can handle many websockets by a thread? without wait? ServerSocket server; private ExecutorService executor = new ThreadPoolExecutor(1_000_000 , 1_000_000 , 7, TimeUnit.SECONDS, queue, threadFactory); try { server = new ServerSocket(port); } catch (IOException e) {} while (true) { Socket client =

Equivalent of exec 3<>/dev/tcp/anyaddress.com/80 in ash

孤者浪人 提交于 2021-02-04 19:40:07
问题 In bash the following command open a socket exec 3<>/dev/tcp/192.168.1.200/8080 In the ash this command does not work. Are there an equivalent of this command for ash? here after the output error of the command in ash: -ash: can't create /dev/tcp/192.168.1.200/8080: nonexistent directory 回答1: No, there is not. The standard POSIX bourne shell doesn't offer this feature. You may be able to accomplish what you need with socat or nc. This bash feature is very strange by the way, considering that

How would one transfer files larger than 2,147,483,646 bytes (~2 GiB) with Win32 TransmitFile()?

丶灬走出姿态 提交于 2021-02-04 19:08:53
问题 Quoted from MSDN entry for TransmitFile: The maximum number of bytes that can be transmitted using a single call to the TransmitFile function is 2,147,483,646, the maximum value for a 32-bit integer minus 1. The maximum number of bytes to send in a single call includes any data sent before or after the file data pointed to by the lpTransmitBuffers parameter plus the value specified in the nNumberOfBytesToWrite parameter for the length of file data to send. If an application needs to transmit

How would one transfer files larger than 2,147,483,646 bytes (~2 GiB) with Win32 TransmitFile()?

血红的双手。 提交于 2021-02-04 19:08:43
问题 Quoted from MSDN entry for TransmitFile: The maximum number of bytes that can be transmitted using a single call to the TransmitFile function is 2,147,483,646, the maximum value for a 32-bit integer minus 1. The maximum number of bytes to send in a single call includes any data sent before or after the file data pointed to by the lpTransmitBuffers parameter plus the value specified in the nNumberOfBytesToWrite parameter for the length of file data to send. If an application needs to transmit

How would one transfer files larger than 2,147,483,646 bytes (~2 GiB) with Win32 TransmitFile()?

一个人想着一个人 提交于 2021-02-04 19:08:21
问题 Quoted from MSDN entry for TransmitFile: The maximum number of bytes that can be transmitted using a single call to the TransmitFile function is 2,147,483,646, the maximum value for a 32-bit integer minus 1. The maximum number of bytes to send in a single call includes any data sent before or after the file data pointed to by the lpTransmitBuffers parameter plus the value specified in the nNumberOfBytesToWrite parameter for the length of file data to send. If an application needs to transmit

sending multiple send/recv in socket

拥有回忆 提交于 2021-02-04 16:47:24
问题 I need bit clarification on using multiple send/recv in socket programs. My client program looks below(Using TCP SOCK_STREAM). send(sockfd,"Messgfromlient",15,0); send(sockfd,"cli1",5,0); send(sockfd,"cli2",5,0); send(sockfd,"cli3",5,0); send(sockfd,"cli4",5,0); send(sockfd,"cli5",5,0); and the server program looks like below. recv(newsockfd,buf,20,0); printf("Buffer is %s\n",buf); when i execute the above program, the output is as below: Client Msg :Messgfromlient I believe that the buf size

sending multiple send/recv in socket

旧巷老猫 提交于 2021-02-04 16:46:55
问题 I need bit clarification on using multiple send/recv in socket programs. My client program looks below(Using TCP SOCK_STREAM). send(sockfd,"Messgfromlient",15,0); send(sockfd,"cli1",5,0); send(sockfd,"cli2",5,0); send(sockfd,"cli3",5,0); send(sockfd,"cli4",5,0); send(sockfd,"cli5",5,0); and the server program looks like below. recv(newsockfd,buf,20,0); printf("Buffer is %s\n",buf); when i execute the above program, the output is as below: Client Msg :Messgfromlient I believe that the buf size