Why does send() in client application block when server is terminated? - windows

I have a server application and a client application (localhost, loopback) which exchange data with each other via sockets.
When I shutdown the server (console) application (via <Ctrl C>) I expect the send() or recv() calls made in the client application to return with an error.
I observe exactly this behaviour on Linux, however after following the same steps on Windows the application hangs indefinitely at send().
What is the reason for this?
How do I ensure that the application is able to detect that the remote connection is closed, in a clean way?
More diagnostics information:
When both the server and client are running I execute netstat -a -o -n -b
and I am able to observe both the client and server socket in ESTABLISHED state.
However after terminating the server program when I run netstat -a -o -n -b
I am not able to see even the client program socket in the list of network connections.

Related

server.bash is not a valid win32 application

I'm trying to host a simple (demo) websocketd server. Basically, it listens to incoming websocket connections and routes them towards my server. However, when I run the websocketd --port=8069 server.bash (In the correct directory, websocketd running as admin) I get the following error when trying to connect to ws://localhost:8069:
Could not launch process .\server.bash (fork/exec .\server.bash: %1 is not a valid Win32 application.)
I've looked into netstat and the 8069 IS listening for incoming connections.
I've also tried running a python server (I have it installed) but I get the same error
//System Info:
I'm running x64 windows 10.
Description of websocketd from the url you provided
It takes care of handling the WebSocket connections,
launching your programs to handle the WebSockets, ....
So basically websocketd is trying to execute server.bash which doesn't work because windows doesn't recognize this file as executable.
This script was probably meant to be run on linux in the first place however if you have installed bash already on windows u can try running it by replacing
websocketd --port=8069 server.bash
with
websocketd --port=8069 bash server.bash

How to start the echo service on OSX Mountain Lion to respond to autossh monitoring

I have the following two machines :
Machine A. OSX Machine which will act as the SSH server
Machine B. An SSH client connecting to the above using autossh
autossh allows persistent, self-healing connections to be made and restarts the child ssh process if it exited abnormally (the man page has details about what 'abnormal' means). Specifically, I am interested in allowing scenario #4 to work:
Periodically (by default every 10 minutes), autossh attempts to pass
traffic on the monitor forwarded port. If this fails, autossh will
kill the child ssh process (if it is still running) and start a new
one
Questions:
What is the recommended monitoring approach with autossh? Would it be monitoring on specific ports or using the echo service ? Or would it be to rely on OpenSSH's ServerAliveDelay so that ssh connections exit timely and disable autossh monitoring altogether?
If it's the latter, how do I start the echo service on osx? From the wiki page of inetd :
As of version Mac OS X v10.4, Apple has merged the functionality of
inetd into launchd.
Therefore, how do I use launchd to start the echo service on osx Mountain Lion?
I would suggest that you stick with ServerAliveDelay and ServerAliveInterval, both of which can be specified inside a local ssh_config file. This will obviate the need for either a monitoring port or the use of the echo service, and will allow the ssh client to handle graceful exits while enabling autossh to restart lost connections.

Accessing Port while starting Websphere Server

i am facing the issue in webshpere ..the server is not staringReading configuration for server: server1
ADMU3028I: Conflict detected on port 8896. Likely causes: a) An instance of
the server server1 is already running b) some other process is
using port 8896
ADMU3027E: An instance of the server may already be running: server1
ADMU0111E: Program exiting with error:
com.ibm.websphere.management.exception.AdminException: ADMU3027E: An
instance of the server may already be running: server1
The error seems quite explicit: another program is using port 8896.
To verify this you can use these commands:
(Linux) sudo netstat -lptu|grep 8896
(Windows) netstat -a -b (or other tools)
You can decide to stop the process that create the conflict or change the ports used by WAS:
Updating ports in existing profile
This can be caused when the services don't shut down correctly and the java.exe processes hold a lock on the applications port. (8896).
To resolve this problem you can use one of the following options.
1) Open your taskmanager and end task the java.exe process for your JVM that is holding a lock on the servers port then restart the JVM from the WebSphere console
2) You can restart the physical server so the java.exe process shuts down and releases the port. Once the server starts back up you can start JVM and bring the application up.

Tuxedo Client or Tuxedo Server

Here is my question and i tried it hard to brainstormed with people in my team and with other resources which i have.
I have to go 100's Linux black-boxes to find if Tuxedo Client is running there or not . How can i tell if Tuxedo Client is on each box.
Maybe Tuxedo Server is running on that box may its just installed and not running .How can i different between Then Tuxedo Client and Server.
Is there any procedure or way or any command which i can used and which can tell me if Tuxedo client is there on box or not.
To check if a Tuxedo domain is running in a server, you could check if there is BBL process running.
# ps -ef | grep BBL
For clients, there are many ways that a Tuxedo client's may connect to servers:
Example:
via:
/WS
JOLT
Direct connection
Weblogic Tuxedo Connector (WTC)
Server calling another tuxedo servers (via tdomain)
To verify tuxedo clients conecting via WTC/JOLT there must be a Weblogic Server OR Java process calling tuxedo servers.
# ps -ef | grep java
To verify tuxedo clients that connects via /WS there must be a WSNADDRR defined in the enviroment of the process.
# ps auxeww |grep -i WSNADDR | grep -v grep

Telnet to Server Trying to Open Program Cant see it

I telnetted to my server and i tried to open a simple program say notepad.exe or skype.exe.For some reason on my desktop it does not open when i use telnet to do so, but a process does initiate when i run it from telnet.
How come i cant see the program open on my desktop when i telnet to my server and run a program?
I am running the telnet server on a vm and using the client on my host computer.
I run simple command like this
*===============================================================
Welcome to Microsoft Telnet Server.
*===============================================================
C:\Program Files\Skype\Phone>Skype.exe
Telnet is a text-based utility. Notepad, Skype, et al require a graphics interface not available to a telnet client, therefore they won't start. It doesn't matter that the telnet client and server are on the same hardware.
You can initiate a process on a remote machine via a telnet client because it doesn't require a user interface.

Resources