Can't bind or listen to Memgraphs sockets - memgraphdb

It makes no difference if I try to bind or listen to Memgraph I get the error. Depengin on the thing that I'm trying to do I get either: Cannot bind to socket on endpoint {} or Cannot listen on socket endpoint {}.

By default, Memgraph uses port 7687. It seems that some other application or process is using that port and is preventing you from connecting to the socket.
Another reason could be starting of another Memgraph instance on the same port.

Related

"Cannot bind to socket on endpoint {}." error within Memgraph

When binding to Memgraph I get the error Cannot bind to socket on endpoint {}. How can I avoid this error?
Make sure that the specified port (the default port Memgraph runs on is 7687) isn't being used by another process or that you haven't already started another Memgraph instance on the same port.

UDPSocket (Ruby) - specifiy / capture local / sending port

I want to send a packet to a host using UDPSocket (Ruby) specifying the port for the reciever.
Can I specify / capture the local port I am sending on? I have looked on https://docs.ruby-lang.org/en/2.2.0/UDPSocket.html and whilst I can specify the port I am connecting to the host on, I cannot see any options / methods for the local port I am sending from.
I wonder if the socket that UDPSocket uses has access to the local port?
Thanks in advance!
Referring to https://docs.ruby-lang.org/en/2.4.0/IPSocket.html (super class of UDPSocket) I can see that the local outbound port is available from the addr method of the socket.
Regards

Cannot reach socket server on AWS EC2

I am trying to run a socket server on an Amazon Web Services EC2 instance. The socket is able to run just fine on it's own, and telnetting locally on the instance can connect, but trying to telnet to the socket from the outside is failing. I have gone into the security groups to ensure the ports I am using are open for both TCP and UDP (though the socket server has been configured for TCP). Is there something else I am missing?
The server might be listening on the loopback interface or ipv6 by default. You can check that by running netstat --listen -p which will show you which program listens on which address/port. How to make the program listen on the external ipv4 interface depends on the program/programming language.

WinSock client ports and router port forwarding

I have a server application that binds to a port and listens on it. I've set up the router to forward the data on this port to the server.
Now, on the client side, I don't actually bind() the socket to any port, and I usually end up with a different port everytime. In that case, how can I prepare the router to forward that port to the client? Or am I supposed to use bind() with the client socket as well? (I remember reading that you're not supposed to do that.)
Firewalls are usually stateful - meaning if TCP connection request into the protected network is allowed, then the packets back to the client are matched (and passed through) automatically. That is to say you don't worry about the client, just setup port forwarding to the server app.

Receiving datagrams using Udp connection

In order to receive datagrams through an UDP connection I have created an object of type UDPClient.
receivedNotificationSock = new UdpClient();
However once done and on using the receive method:
receivedHostNameBuffer=receivedNotificationSock.Receive(ref receivedNotificationIP);
I am getting an exception saying that I must call the bind method.
But there is no bind method in the UDPClient class.
Could You guys please provide me with the code if possible as to what should be done to overcome this exception.
You need I think to know some more about sockets.
All sockets possess a port number. First, you create a socket - which is almost useless on its own. It just floats there. But then you bind it - you assign it a port number. Now it's useful - now you can send and receive data on it.
Remember, all UDP communications are defined by the quad data set of the IP and port of the source and the IP and port of the destination. A freshly created socket doesn't have an IP address or port; binding gives it an IP address and port.
Unfortunately, I'm not a C# programmer, so I can't properly answer your question. But at least you know why it's important.
Pass the port number into the constructor of your UDP client.
receivedNotificationSock = new UdpClient(21000);
You may need to change firewall settings to allow the bind, though a popup window normally opens when you first run this on your dev machine.
For Socket proramming you need to know the sequence of syscalls you need to do on client side and on the server side.
If you are writting a client :
you open a socket with a socket call.
you then connect to the server port with a connect call
once connect is successful
then you send the request to the server using either a send or sendto or a write
which results in reception of data that you can read using a receive or read
On Server Side
you create a socket
bind it to a port
start listening on the socket for incoming connections from various clients using a listen.
There is a non blocking way of listening for connections as well with a select syscall.
Once the you establish a connection you can essentially read the request and start processing it.
Here's an example in C# that may be useful to you.
http://www.developerfusion.com/article/3918/socket-programming-in-c-part-1/

Resources