Posts

Showing posts with the label sockets

How to create an adhoc network between laptops in java?

How to create an adhoc network between laptops in java? I want to create an adhoc between labtops were they will communicate using wireless communication. I will use java for this but still I do not know how to start.. I think I'll have to use sockets for the connections right? How will a laptop notice other laptops in its local network or the other way around? Do i need a server to handle the communication between laptops? Another thing, how to broadcast a message from one laptop to other laptops in the network? Please reply as soon as you can. Any help will be appreciated. Thanks in advance. Do you explicitly want to create the adhoc network in java on your own? I mean, you can use the existing application/services to create the network. Once the network is on, you can communicate between them as you would do on a normal LAN. – Vikram.exe Dec 31 '10 at 7:35 ...

How can I get the amount of payload received when an timeout exception throws (Android)?

How can I get the amount of payload received when an timeout exception throws (Android)? In the application that I am developing in Android, I send bytes of number 5 using sockets tcp and udp. I would like to know if it is possible to get the amount of payload that was received until a SocketTimeoutException exception was thrown.I'm doing some moving tests with Wi-Fi Direct technology so, when sending, all may not be received because the peers are disconnected before. Also for the case of UDP when packet loss occurs I would like to know the amount of information that I receive. To read what I get, I use readFully and recieve. This reception is done in a single step or in a loop in which I receive large amounts of information. I could not receive the bytes one by one because it would be really slow. TCP RX: ServerSocket serverSocket = new ServerSocket(SERVERPORT); Socket client = serverSocket.accept(); DataInputStream DIS = new DataInputStream(client.getInputStream()); int tamMensaj...

Trying to do a broadcast server that echos clients

Trying to do a broadcast server that echos clients I'm trying to do a simple group chat where there's a server and several clients. The objective is when a client sends a message to the server, the server just sends that message back to all the other clients. I had the server send a message writen by him send to all the clients but he didn't send the clients message. Server code: package Group; import java.net.*; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.*; public class GroupServer extends Thread { private ServerSocket server; protected List<ClientHandler> clients; public static void main(String args) throws IOException { new GroupServer(9876); } public GroupServer(int port) { try { this.server = new ServerSocket(port); System.out.println("New server initialized!"); clients = Collections.synchronizedList(ne...

Socket BeginEnd operations and pinned buffers in .NET 4.6

Socket BeginEnd operations and pinned buffers in .NET 4.6 According to Performance Improves in .NET 4.6 and this answer, Is it possible to get OutOfMemoryException while using async socket APIs in .NET 4.6 ? The answer is yes. A system can only handle certain load, and you should scale it up when larger load is expected. There are other optimization approaches (hidden in the words of that Stack Overflow thread as well). – Lex Li Jun 30 at 15:00 By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Qt application running with `-platform offscreen` argument cannot establish websocket connection

Qt application running with `-platform offscreen` argument cannot establish websocket connection I have a GUI application which contains a websocket server QWebSocketServer . I also have a python script which sends messages and the application processes them. Everything works well. During testing I wanted to run the application in headless mode using -platform offscreen command line argument added to the app executable name (I changed nothing else). But the problem is that when the application runs off-screen, the client script cannot establish connection with the web socket server. I tested this on localhost only. I do not understand how this two things, visibility of GUI and websockets, can interfere. Any ideas what could go wrong? QWebSocketServer -platform offscreen Note: I am using Qt 5.11.1 64-bit with VS 2017 on Windows 10 Pro. I further exploring the issue. I tried the same with another application and it seems to work well even for -platform offscr...

Angular Sockets are not working in deployed version

Image
Angular Sockets are not working in deployed version Im using Angular6, and StompRService from '@stomp/ng2-stompjs'; my application contains chat system between users and group, after initializing the application, i request a socket connection with the server: public initMessagesSocket() { this.stompService.config = { url: new SockJS(this.httpService.urlCheck('/secured/ws')), headers: {}, heartbeat_in: 0, heartbeat_out: 20000, reconnect_delay: 5000, debug: true }; this.stompService.initAndConnect(); const userLogonId = this.loggedInUserInfo.user.logonId; const stompSubscription = this.stompService.subscribe('/user/' + userLogonId); return stompSubscription; } this code works locally, but when the code deployed on public server. i noticed some error logs in the console and weird requests is fired periodically with post method. this is a screen shot from the logs and network traffic thanks in advance. ...