Simulate network lag when client and server are on the same dev PC - eclipse

With my limited resources and to aid debugging, I am doing local testing on a client-server (game) application by running both a server and one or more clients all on my Windows 7 dev PC. Both client and server are Java applications developed through Eclipse.
Is there any easy way to introduce lag given that everything is running on the same PC... maybe 'hack' the port used or something? Or is this only possible if each application is running on a separate PC (or separate VM)?

Make a feature in the server which makes a random lag within certain time range if detected connection comes from localhost. You can then switch this feature on/off as needed.

Related

Virtual (fake) primary monitor in Windows 10?

I have a bunch of automated UI tests that currently require a physical monitor to run. Can I somehow create a virtual monitor in Windows 10 that functions like a real monitor to the OS? I want to run the UI tests in a remote cloud environment without screens.
I think I heard sometime that VR-development (Virtual Reality) have had similar problems in that VR also need a physical monitor attached (except the VR-headset) and that this was perhaps solved by Nvidia/Intel? with a fake monitor driver or similar? Or was it virtual desktops in VR? I can't find the source for any of this anymore...
The easiest way is to use the Spacedesk utility:
https://spacedesk.net/
Spacedesk server part is installed on your PC.
The client part (viewer) will also be required - any device on Android/Windows in same LAN segment.
Small hack:
You can also install Windows Client on Spacedesk server PC and manually assign client IP from another subnet. As a result, you will assume real Windows fake display )...

OS X Disable Internal Network Between Apps Temporairly

I am supporting development of a client application that will be communicating to a seperate enterprise service bus. We have our own black box services to develop against. We each host multiple REST endpoints (using RESTeasy) to communicate.
One scenario we need to demonstrate to our client is sudden loss of network connectivity between my client application and their ESB with later network restoration. In the client demonstration, they plan to have separate workstations connected by a router and pull the cables for a few minutes and then reconnect them.
My question is that, while keeping both app running in eclipse on my workstation, can I temporarily block them from making successful REST requests to each other and then restore the connection? As best as possible to simulate the demonstration objective of pulling the network cables.
OS X El Capitan; Eclipse Neon; Jetty 9.2.7
Self Answer:
Not as elegant as I would like, but works because the endpoints are already compile-time configurable.
Add an entry to /etc/hosts for a volatile domain pointing to 127.0.0.1
127.0.0.1 volatileDomain
Configure my endpoints to point to volatileDomain.
Start both apps.
Edit and save /etc/hosts to comment out the volatileDomain line.
Watch disconnection logic handle the current state.
Edit and save /etc/hosts to reintroduce the volatileDomain line.
Watch reconnection logic reestablish the connected state.

Java: Writing a Datagram Client and Server from Eclipse

I am Writing a Datagram Client and Server using eclipse with the class DatagramSocket. My question is: first I run the server from Eclipse, but when I run the client the server will continue work or just terminate ?
I wrote a server discovery system while attending computer networks course at my university, have a look:
https://github.com/colonder/Rudolph-server-discovery-system
It was a bit ago but as far as I remember both server and client are separate threads so one shouldn't kill the other, but I'm not so sure about running both things in the same Eclipse instance. When I was coding it at home I had only one machine available, so I guess it's possible to run both of them in the same Eclipse instance.

OpenSplice V6.3 fails on Network

although i have been using OpenSplice V5 for connecting my platform running on different nodes, now i upgraded OPensplice to V6.3 but i am getting failures on my platform as if no connection.
what i did is that i tried connecting the helloWorld windows version (one 32 bit and another 64 bit) together on the default hello world example but with no success.
do anyone can help solving this issue and advise what parameters must be fine tuned on the ospl.xml file for using network connectivity using unicast?
thx,
What I've seen before is that sometimes people use machines that have multiple interface-cards connected, in which case you have to explicitly configure the interface to use in the DDSI configuration (rather than the 'AUTO' default).
Furthermore, if you want to enforce unicast, you have to configure your unicast-peers in the DDSI discovery section of the config-file.
Note that DDSI also automatically switches between unicast and multicast depending on the number of discovered endpoints (i.e. it will use unicast in case only 1 endpoint is discovereed)

objective-c : iphone programming wirelessly lock computer from iphone

i am doing an application in which i need to lock,turn off the computer wirelessly.
It is possible?
Yes, but you'll have to write two programs:
The iPhone app that sends the lock command to the computer (over the network)
A program running on the computer that listens on the network for commands and locks the computer when it gets them
It's possible. For example, you could run a daemon on your computer that listens for a command to lock or shutdown, and your iPhone app can connect to the computer and issue the appropriate command. Of course, you have some considerations such as firewalls, NAT, and security issues to deal with.
To bypass some of the problems Jeff mentioned, you need to build a service that brokers communication between the iPhone app and the machine.
The program running on the machine needs to talk to this service over HTTP/S (so no NAT/Firewall problems), and keep polling (see long-polling). The iPhone app sends the server information when it wants to shut down the computer. The server sends an appropriate response in such a case to the long-poll, at which time the client software on the computer turns it off.
So yes, to do this right you need a stateful server.
Good luck.
Airlock does something similar for the iPhone/Mac via a System Preferences plugin and bluetooth (but no app on the actual phone).