This Code For Initialize Socket Server on emulator android but Cann't Transfer Data and Get in Logcat of eclipse warning exception " bind failed: EADDRNOTAVAIL (Cannot assign requested address) "

ServerSocket serversock=new ServerSocket(); 
DataInputStream  Input_Data_Stream=null;                  
InetAddress address1 =InetAddress.getByName("");
InetSocketAddress g =new InetSocketAddress(address1, 8080);
Socket Client_Socket=serversock.accept();  
Input_Data_Stream=new DataInputStream(Client_Socket.getInputStream());
String message=Input_Data_Stream.readUTF();
 Log.d("Message", message);


This in other Way snippet code socket server and have same exception Socket is already bound

serversock=new ServerSocket();
serversock.bind(new InetSocketAddress("", 8080));

This Code I did not get on Previous Exception but when Execute "serversock.accept();" for Start Listen on PORT I got Error exception and if use a different iP address "" Will got on warnnig exception " bind failed: EADDRNOTAVAIL (Cannot assign requested address)"

SocketAddress Address= new InetSocketAddress("", 8080);
serversock=new ServerSocket();

This Code Socket Client

Socket Socket1 =null;
DataOutputStream Output_Data_stream=null;
Socket1=  new Socket("", 8080);
Output_Data_stream=new DataOutputStream(Socket1.getOutputStream());
catch (UnknownHostException e)
				catch(IOException e)

This question already has an answer here:

I have an app which listens for a socket connection, and then uses DispatchSource.makeReadSource to read from the socket. This bit is working great:

let mySocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
// bind(...)
listen(newSocket, 1)

let clientSocket = accept(...)

let clientListener = DispatchSource.makeReadSource(
    fileDescriptor: clientSocket, 
    queue: DispatchQueue.main)
clientListener.setEventHandler {
    // Called when data is available, and I can read it without problem

My problem is while the dispatch source is waiting for data from the client, if I deploy my app (or stop my app) using Xcode, somehow the socket remains open and I cannot setup my socket again. When I call bind it returns -1

I have to restart my device for the socket to be released again

I've tried cleaning up my sockets when the app is closed, but I can't seem to detect when Xcode kills my app:

  • applicationWillTerminate is not called in my app delegate
  • deinit isn't called in any of my classes
  • none of the life cycle methods are called in my view controller

I'm not sure how the socket is remaining open as I would assume iOS would kill of all the resources when it killed the app

Is there a way to stop the dispatcher from holding on to the socket?

After seeing several posts about this error, I don't really understand why the sometimes I am getting this exception

I saw several posts here that suggested to do a loop over binding the socket, but I think it should be executed once and there is a problem somewhere else

this is my code:

 public ServerNetworkThread()
        _port = Logics.getInstance().getSharedPrefsManager().getInt(SharedPreferencesManager.SERVER_PORT_KEY, Consts.SERVER_PORT);

    public void setHandler(Handler h)
        _handler = h;

    public void run()

        _isWorking = true;
            _serverSocket = new ServerSocket();
            _serverSocket.bind(new InetSocketAddress(_port));

            while (_isWorking)
                _socket = _serverSocket.accept();

        catch (SocketTimeoutException e)
            Logger.d("anton", e.getMessage());
        catch (IOException e)
            Logger.d("anton", "server thread IOException" + e.getMessage());


    private void readDataTest() throws IOException
        //          BufferedReader inFromClient = new BufferedReader(new InputStreamReader(_socket.getInputStream(),Charset.forName("UTF-16LE")));
         //          BufferedReader inFromClient = new BufferedReader(new InputStreamReader(_socket.getInputStream(),Charset.forName("UTF-16LE")));
        InputStream iStream = _socket.getInputStream();
        InputStreamReader in = new InputStreamReader(iStream, Charset.forName("UTF-16LE"));
        DataOutputStream outToClient = new DataOutputStream(_socket.getOutputStream());
        char[] buf = new char[1024];
        int lettersCount =, 0, buf.length);
        String request = new String(buf,0,lettersCount);
//      request = request.split(Consts.EOF)[0];
        Log.d("test","server got request="+request);

        String responseStr = parseResponse(request);
        byte[] response = responseStr.getBytes("UTF-16LE");

this is my exception:

W/System.err( 1433): bind failed: EADDRINUSE (Address already in use)

W/System.err( 1433): at

W/System.err( 1433): at

W/System.err( 1433): at

W/System.err( 1433): at

W/System.err( 1433): at

W/System.err( 1433): Caused by: bind failed: EADDRINUSE (Address already in use)

W/System.err( 1433): at Method)

W/System.err( 1433): at

W/System.err( 1433): at

W/System.err( 1433): ... 4 more

it is something to do with this line:

 _serverSocket.bind(new InetSocketAddress(_port)); Address already in use: JVM_Bind at Method) at at at at at at at$AbstractUnsafe.bind( at$HeadContext.bind( at at at at at io.netty.bootstrap.AbstractBootstrap$ at at io.netty.util.concurrent.SingleThreadEventExecutor$ at

I am deploying 3 different web forms applications on a VM server. The customer has installed the certificate on the server. And the IT tells me to bind each application to a different IP address. I created 3 web sites (pointing each to a different physical folder). But when I bind each site (in IIS) the IP address pull-down shows only one IP address (and All Unassigned). How would I bind 2 other sites to different IP addresses?

I am trying to run NodeJs file using Visual studio but it is showing me error annot find 'ripple-lib' and this folder is already existed in NodeJs i just drag and dropped this folder to project and when i am running this file using F5 this is showing me error and if i am running this file using command prompt it is running successfully.

below is my compleate source code of Node.js

'use strict';
const RippleAPI = require('ripple-lib').RippleAPI; // require('ripple-lib')

const address = 'rJdqcGV4eytsm4CMpJ8gJ9RdDZnSPoL5Be'; //Test Address
const secret = 'ssX5xpgiFB5ug2birYcU4sXBEe2cx';    // Test Address

const api = new RippleAPI({server: 'wss://'});

const instructions = {maxLedgerVersionOffset: 5};

const payment = {
source: {
 address: address,
maxAmount: {
  value: '0.01',
  currency: 'XRP'
destination: {
address: 'rfH1Ca3NXSLXNBxKrgYUaAbArijUrMsxrZ',
tag: 8779,
amount: {
  value: '50',
  currency: 'XRP'
function quit(message) {


function fail(message) {


api.connect().then(() => {
return api.preparePayment(address, payment, instructions).then(prepared => {
console.log('Payment transaction prepared...');
const {signedTransaction} = api.sign(prepared.txJSON, secret);
console.log('Payment transaction signed...');
api.submit(signedTransaction).then(quit, fail);



I have 2 dual-h bridge controllers(used to supple power to fans) that are connected to my raspberry pi 3 b via GPIO and a battery for power I have created a script in python 3 that uses Bluetooth classic to ask the connected phone in a terminal how long the fan should be on for and how long they should be off for in a loop I have got this to work GREAT, but this works only on android as it is Bluetooth classic i now want to make this work for my iPhone as well i found out i would need to use BLE so my question is how can i convert my original script in Bluetooth classic(using RF COMM Sockets) to use Bluetooth Low Energy.

Here is my original script

# Importing the Bluetooth Socket library
import bluetooth
# Importing the GPIO library to use the GPIO pins of Raspberry pi
import RPi.GPIO as GPIO
import time

fan_pin = 16# Initializing pin 16 for fan
fan2_pin = 18
GPIO.setmode(GPIO.BOARD)    # Using BCM numbering
GPIO.setup(fan_pin, GPIO.OUT)   # Declaring the pin 16 as output pin
GPIO.setup(fan2_pin, GPIO.OUT)  # Declaring the pin 16 as output pin

host = ""
port = 1    # Raspberry Pi uses port 1 for Bluetooth Communication

# Creaitng Socket Bluetooth RFCOMM communication
server = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
print('Bluetooth Socket Created')

    server.bind((host, port))
    print("Bluetooth Binding Completed")
    print("Bluetooth Binding Failed")

server.listen(1) # One connection at a time
# Server accepts the clients request and assigns a mac address. 
client, address = server.accept()
print("Connected To", address)
print("Client:", client)
while 1:

    # Receivng the data. 
    client.send("How long do you want the fans to be on for?/n")
    On = int(client.recv(1024)) # 1024 is the buffer size.
    client.send("Ok, Now how long do you want the fans to be off for?/n")
    Off = int(client.recv(1024))
    while True:
        GPIO.output(fan_pin, GPIO.HIGH)
        GPIO.output(fan2_pin, GPIO.HIGH)
        GPIO.output(fan_pin, GPIO.LOW)
        GPIO.output(fan2_pin, GPIO.LOW)

# Making all the output pins LOW
# Closing the client and server connection

I would imagine this would be as simple as changing anything that was Bluetooth classic code to BLE code. Max like 20 lines to change? Thanks in advance for anyone who helps!

I am reading about socket programming and got to know that ip is assigned to socket with bind() call before connection to server.Is my thinking of binding address means to bind any ip address correct.

This question already has an answer here:

I am Trying to validate email address field using below regex

    + (BOOL) isValidEmail:(NSString *)email
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    return [emailTest evaluateWithObject:email];

But its getting failed for validating below cases.





Please suggest me what modification do I need for considering these cases.

I'm setting up a nodejs server. i made json array parser using swift but json data is array from nodejs server. i know json dictionary type parsing. i have type casting problem what can i do ?

json array type casting as? [[string:anyobject]] i've already tried . There are still exist problem. example, i can see nil, error (dictionary always fail) my server -> nodejs , redis


            let json = try! JSONSerialization.jsonObject(with: data, options: []) as? NSArray

            print("jsonserial = \(json!)")

            self.event = [Module]()

            for dict in json as? [string:Anyobject]{

                let events = Module()

                events.dateOfevent = dict!["datetime"] as? String
                events.restaurantAddr = dict!["address"] as? String
               events.latpin = dict!["lat"] as? String
                events.longpin = dict!["long"] as? String
                events.citystate  = dict!["citystate"] as? String
                events.userid = dict!["userid"] as? String


               // print(self.finalArray)
            DispatchQueue.main.async {



        } catch let jsonError{

json array type casting as? [[string:anyobject]] i've already tried . There are still exist problem. example, i can see nil, error (dictionary always fail)

->json data (get from url)

["{\"address\":\"Second St,Davis,CA\",\"citystate\":\"Davis,CA\",\"lat\":\"38.54369\",\"long\":\"-121.7395931\",\"datetime\":\"09:42 16/02/2019\",\"userid\":\"lll\"}","{\"address\":\"Universal City Plaza,Los Angeles,CA\",\"citystate\":\"Los Angeles,CA\",\"lat\":\"34.13708590566492\",\"long\":\"-118.355171084404\",\"datetime\":\"03:37 14/02/2019\",\"userid\":\"lll\"}","{\"address\":\"N Harbor Dr,San Diego,CA\",\"citystate\":\"San Diego,CA\",\"lat\":\"32.732373382591\",\"long\":\"-117.1975028514862\",\"datetime\":\"08:27 15/02/2019\",\"userid\":\"lll\"}"]

I'm working on a webpage that requires you to input the address and contact information of a related party, up to three related parties. I'm doing this by putting the controls needed into a Repeater inside of an UpdatePanel, and then setting the Repeater datasource to a dummy array of integers on button click - this allows me to control how many times it repeats, and it works excellently.

However, when the user has already input some information and decides they need an additional row, it overwrites everything they've already written, due to it binding from a blank datasource. I've seen a few solutions where they put the data from the controls into a dictionary/list/similar object at postback, update the repeater, and then put them back in, but I'd like to avoid that if possible (which it probably isn't), as there's about a dozen fields per repeater row.

So, my question is how can I add a new row to this repeater without reloading the previous rows? Is it possible?

Using ASP.Net with a VB.Net codebehind, focused on working in IE.