client-server

Many threads or as few threads as possible?

旧街凉风 提交于 2019-12-18 10:56:32
问题 As a side project I'm currently writing a server for an age-old game I used to play. I'm trying to make the server as loosely coupled as possible, but I am wondering what would be a good design decision for multithreading. Currently I have the following sequence of actions: Startup (creates) -> Server (listens for clients, creates) -> Client (listens for commands and sends period data) I'm assuming an average of 100 clients, as that was the max at any given time for the game. What would be

Simple Java TCP Server and PHP Client Problems

荒凉一梦 提交于 2019-12-18 05:04:21
问题 I am trying to set up a simple TCP connection on a single port between a Java application that will act as the TCP server and a PHP scrip that will act as the Client. I will post the code for each below, but the problem is: I can connect and send data to the Java server just fine. I can get that data and print it out. My problem arises in trying to send a response back to the php server. When I comment out that last line of php "echo socket_read($socket, 14, PHP_NORMAL_READ);" The data gets

Handle a WPF Exit Event

有些话、适合烂在心里 提交于 2019-12-18 04:34:22
问题 I was wondering if there was a way to handle a WPF Application Exit event such that the exit was cancelled. The use case is that I have a client-server situation where the server is a WPF app. I want the WPF app to notify the client when it is shutting down, but cancel the shutdown process. The client should receive the shutdown notification, do its own required cleanup and then ask the WPF app to shutdown via a request. Is this possible? 回答1: You can hook the event Closing on your main

One complex query vs Multiple simple queries

房东的猫 提交于 2019-12-18 04:33:26
问题 What is actually better? Having classes with complex queries responsible to load for instance nested objects? Or classes with simple queries responsible to load simple objects? With complex queries you have to go less to database but the class will have more responsibility. Or simple queries where you will need to go more to database. In this case however each class will be responsible for loading one type of object. The situation I'm in is that loaded objects will be sent to a Flex

System.InvalidCastException when creating a client activated object using an older version of an interface defined in a strong named assembly

和自甴很熟 提交于 2019-12-17 21:32:49
问题 I have a query about .Net Remoting, versioning and creating client activated objects. Here is the scenario: There are 2 interfaces, residing in their own assembly “SharedTypes”: IServer and IAccount. IServer contains methods “GetStatus” which returns a string, and “CreateAccount” which returns an IAccount type. This is registered into the GAC as v1.0.0.0. Server application references SharedTypes and implements IServer and IAccount with concrete classes, Server and Account. These are

JasperReports Default Font

混江龙づ霸主 提交于 2019-12-17 20:57:27
问题 I have a JasperReport template (generated on the Server) with a Styled Textfield (RTF). The Content of this field is User generated, and so it can contain all Fonts installed at the Clients PC (call it Font X). If I generate now a Report on the Server, there is no Font X, so I want to replace all unknown Fonts to Font Y. But all I get is an error, that the font is not found. The feature (net.sf.jasperreports.awt.ignore.missing.font) to turn off Font Checks in general isn't desired, because I

Is it possible to run a socket server and socket client on the same machine?

天大地大妈咪最大 提交于 2019-12-17 15:44:29
问题 In java it is possible to create a socket server and a socket client, is it possible to have an instance of the socket server running and a socket/server client that is receiving data from the socket server on the same machine? e.g the socket server runs on port 60010 and the socket client is running on the same machine connecting to that port through a socket or will I need to by a new machine and add it to my network? If it has a unique IP Address and port number running on the TCP/IP layer

How to get server response with netty client

折月煮酒 提交于 2019-12-17 10:44:20
问题 I want to write a netty based client. It should have method public String send(String msg); which should return response from the server or some future - doesen't matter. Also it should be multithreaded. Like this: public class Client { public static void main(String[] args) throws InterruptedException { Client client = new Client(); } private Channel channel; public Client() throws InterruptedException { EventLoopGroup loopGroup = new NioEventLoopGroup(); Bootstrap b = new Bootstrap(); b

Is there a WebSocket client implemented for Python? [closed]

霸气de小男生 提交于 2019-12-17 10:09:56
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I found this project: http://code.google.com/p/standalonewebsocketserver/ for a WebSocket server, but I need to implement a WebSocket client in python, more exactly I need to receive some commands from XMPP in my WebSocket server. 回答1: http://pypi.python.org/pypi/websocket-client/ Ridiculously easy to use. sudo

Multithreading Socket communication Client/Server

╄→尐↘猪︶ㄣ 提交于 2019-12-17 09:15:40
问题 I finished writing a Client/Server Socket communication program that works fine. Now I'm trying to figure out how to make it so that I can have multiple Client connections to the Server at once. I've looked around and there seems to be more than a couple of different ways to do this. so I've come here to ask you guys for help/suggestions. My Server: public class Server { private ServerSocket serverSocket = null; private Socket clientSocket = null; public Server() { try { serverSocket = new