client-server

Wrap synchronous code into async await in disconnected scenario

与世无争的帅哥 提交于 2020-01-16 14:49:08
问题 I have the following client-server style pseudo-code: public void GetGrades() { var msg = new Message(...); // request in here QueueRequest?.Invoke(this, msg); // add to outgoing queue } In another processor class I have a loop : // check for messages back from server // server response could be a "wait", if so, wait for real response // raise MessageReceived event here // each message is then processed by classes which catch the event // send new messages to server if (queue.Any()){ var msg

NAT router blocking JMS messages

浪子不回头ぞ 提交于 2020-01-16 07:05:12
问题 I have an openjms-0-7-7 instance running on my cloud machine. The connection to the jms topic happens over tcp. I run the client application on my personal computer at home and I am able to send messages to the topic (which then get forwarded correctly to other listeners) but I am unable to receive messages. My PC is connected to the internet through a NAT router. I have tried to reproduce this issue using my university network and it all worked fine (there I am assigned my own external IP

run method onclick crash in android

不打扰是莪最后的温柔 提交于 2020-01-15 11:15:23
问题 I am currently working on writing a simple message application on Android. I have the server in a class called runServer , which runs perfectly. Then i have a client in a method in my mainActivity . I have a button , which has an onclick="startClient" . but whenever i run an click on the button , i get an error. 03-11 13:01:40.622: E/AndroidRuntime(718): java.lang.IllegalStateException: Could not find a method startClient(View) in the activity class com.example.datorkomprojekt.MainActivity

PrintWriter or any other output stream in Java do not know “\r\n”

一世执手 提交于 2020-01-14 09:44:10
问题 I have trouble using PrintWriter or any other output stream to send message between server and client program. It works properly if I use println("abc") to communicate, but it does not work if I use print("abc\r\n"), print("abc\n") or print("abc\r"). What I mean by "it does not work" is that the readLine() will not end because it seems not to see "newline" character and it is still waiting for "\r" or "\n" To make it more clear, I will simply put some codes in the following: The client:

How do I control access to my server-side data?

China☆狼群 提交于 2020-01-14 04:57:09
问题 I have created an iPhone application which fetches data held on a server in an XML file. How do I check that the request for the data is coming from my app and not from some other source such as another iPhone app or a desktop browser since currently you could just trace the iPhone request on your LAN with Wireshark and then use the captured URL to load the data in a desktop browser. I'm thinking I'm going to need to serve the file via PHP or something and use some sort of User Agent

How to disable Open file – Security warning

安稳与你 提交于 2020-01-13 09:22:11
问题 I have a weird question. I have written a winform server application and a winform client application. The role of the client is to send commands for running a certain script to the server. The server receives those commands, parses them, and runs them. These two work great. I have written a cmd application which uses some of the functions from my client. This application is supposed to function as a cmd client. The question is this: When I run the winform client, the server runs the commands

How to send data from server to Android?

左心房为你撑大大i 提交于 2020-01-12 05:51:13
问题 I am working on a project where I want my server to send some data to my application (without calling of web service from mobile). It is like a web panel which operates mobile app to add data. So when user add data in website and click add, it should add that data to the mobile app (if mobile is connected to the internet). It is also like sending command to android app. I planned to use Push Notification (GCM) for this, but push notifications will not be a good option as I dnt want user to

Setting up a TCP/IP Client and Server to communicate over a network

 ̄綄美尐妖づ 提交于 2020-01-12 03:41:07
问题 I am trying to learn a little about socket programming and I have stumbled across TcpListener and TcpClient to use as I read they are slightly easier for beginners. The basic jist of what I want to accomplish is to have a small form that can be run on my laptop and another laptop on the same network and for them to be able to communicate i.e. send a string of text to each other. Once I have this I will hopefully develop it further :) So far I have created both a Client and a Server program

TCP client and server, cmd prompt using objectstreams

允我心安 提交于 2020-01-11 14:35:10
问题 I have one client file clientRPC.java and server file serverRPC.java. Both communicate using TCP protocol and use objectinput and output stream to transfer data. my client file: public class clientRPC { public static void main(String args[]) { Socket s = null; try { int serverPort = 8888; s = new Socket("localhost", serverPort);// server name is local host //initializing input and output streams object and referencing them to get input and output ObjectInputStream in = null;

NetworkStream.Read() doesn't work and throws ArgumentOutOfRangeException

天涯浪子 提交于 2020-01-11 12:43:12
问题 Just trying to create a chat server-client This is the server waiting for a client connection (optional)* TcpListener serverSocket = new TcpListener(8888); int requestCount = 0; TcpClient clientSocket = default(TcpClient); serverSocket.Start(); Console.WriteLine(" >> Server Started"); clientSocket = serverSocket.AcceptTcpClient(); Console.WriteLine(" >> Accept connection from client"); Then, the client connects to the server (optional)* System.Net.Sockets.TcpClient clientSocket = new System