client-server

Client-Server Java GUI: read/write causing program to freeze

泄露秘密 提交于 2019-12-20 03:54:15
问题 I'm doing a client/server program in Java (including a GUI). I've got the following code in the client: public class SBListener implements ActionListener{ public void actionPerformed(ActionEvent e){ try{ outToServer.writeUTF(usn.getText().trim()); System.out.println("sent username to server"); playerExists = inToClient.readBoolean(); System.out.println("past getting player"); System.out.println("player exists = " + playerExists); }catch(IOException a){ System.err.println(a); } if(playerExists

Using Java to Query a Server for the Time

烈酒焚心 提交于 2019-12-20 02:15:51
问题 I want to ask a server, whose IP I know, to send the date and time to a client. How can I implement this in Java? 回答1: Article describing the details: http://www.informit.com/articles/article.aspx?p=26316&seqNum=3 client http://commons.apache.org/net/apidocs/org/apache/commons/net/ntp/NTPUDPClient.html 回答2: To start with you'll need to clarify (for yourself as much as anything): What kind of server are you going to ask? How are you going to ask it? What kind of IP are you expecting the server

to read the packet of bytes on client(client Socket) from server(ServerSocket) using java

此生再无相见时 提交于 2019-12-19 11:32:09
问题 i m a new . i m a java developer(fresher) and currently i m working on BSE project and i m facing problem to read the packet of bytes on the client(client socket) from the server(server socket). if u can help me then please help me. Thanks in advance 回答1: Well, if you want to interact directly with packets, then you need to use a DatagramSocket instead of the regular Socket and ServerSocket . Then, you should visit this link to see a good tutorial on how to get started with sending and

Multi-client / server tcp application using qt

偶尔善良 提交于 2019-12-19 11:02:43
问题 i am working on a project that requires tcp communication between a "master" application and a number of "servants". (the project is in c++ and i am also using qt) The "servants" will do some processing and send their results to the "master". So far it's a straightforward multi client-server app. The thing is that at random times, the master will request some extra info from the servants, and even send them info to change the way they process. if i base my project on the fortune client/server

multithread client-server chat, using sockets

℡╲_俬逩灬. 提交于 2019-12-19 04:57:13
问题 Server and client communicating with my own protocol which looks like XMPP. I should to realize chat application. So when one user write String it immedeatly should be sended to other client through the server. I have method sendToAll on server. But user see the message of other user only when it press enter. How can user receive messages without pressing enter button? So this is my client: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import

Send multiple asynchonous requests on a Netty client

一世执手 提交于 2019-12-19 03:12:17
问题 first, let me explain the context : I've got to create a client which will send many HTTP requests to download images. These requests has to be asynchronous because as soon as an image is completed it'll be added to a queue and then print to screen. Because images can be large and responses chunked, my handler have to aggregate it into a buffer. So I follow the Netty examples codes (HTTP spoon example). Currently, I've got three static Map to store for each channels the channel ID and the

Why can't the server get the client MAC address, like the client IP?

我们两清 提交于 2019-12-18 14:51:57
问题 From what I know, all the MAC addresses that the packet gone through are in the packet. This is because that each packet that goes in a certain path, should also be returned in similar path. So, if the router of the server know about the mac address of the client (all of them), why the server page (like aspx) cannot have this information? Please, give an explanation. (don't just tell me that I'm wrong). If I understand it correctly, the client sends a packet that contains it's MAC address.

Android Client Server communication

爱⌒轻易说出口 提交于 2019-12-18 14:50:01
问题 I have an application in Android which get latitude and longitude from GPS. I want to send these lat and long to server at particular port and want to receive the response of server into my Android application. Kindly give the direction so that I can make it possible. 回答1: There are many ways to perform this data transfer using the Android platform. My preference is to use JSON to communicate between the App and the server. For an example of how to implement this in your app read through this

Resume file upload/download after lost connection (Socket programming)

你说的曾经没有我的故事 提交于 2019-12-18 12:44:24
问题 I'm writing a program to download/upload a file between a client and server using socket programming. The code i've written till now works in the sense that i can sucesfully transfer files. However , if a connection fails due to problem in the network/client/server while a download / upload is occuring.. i need to RESUME the download/upload from the original point(Do not want the originally sent data to be resent). I'm not sure how to go about this. I'm reading the file into a byte array and

Client-Server database application: how to notify clients that data was changed?

放肆的年华 提交于 2019-12-18 12:01:43
问题 Is it possible to know when and if the contents of certain tables in a database has changed? How can my SQL Server notify the client applications that the data was changed by another user? How to implement query notifications with dbGo ? Do my clients need to poll the database, or is there a callback mechanism for this? My client is a Delphi application with TADODataSet , and my server is SQL Server 2005/2008, serving multiple clients. 回答1: The Delphi dbGo controls does not support Query