implement junixsocket sample code

implemented the sample code from junixsocket
fixed some minor bugs