SOCKS5 UDP Associate after SOCKS5 Connect to TCP at HTTP Web-Server? - socks

question in title.
I have tried to send a TCP packet to an http endpoint, which worked.
However since all requests after that are forwarded and not handled it seems,
how do I establish a UDP associate afterwards?
Thanks in regards, any help is appreciated.

Related

Configuring multiple gateways in a batman-adv mesh network

I have been able to set up a wireless mesh network using batman-adv running on a few Raspberry Pis. The Pis are able to detect each other on the mesh, communicate between each other, and share an internet connection if any Pi on the network is acting as a gateway.
The problem I am facing is that if multiple gateways exist on the network, the clients (devices which are receiving the internet connection by the gateway) will never switch to getting their internet connection from any other gateway than the one they initially obtained it from, even if the routing algorithm detects that they have a better connection to another gateway.
Each gateway is running a DHCP server to assign IP addresses to the clients accessing the internet through them. The DHCP server I am using is dnsmasq.
The expected behaviour is either:
the clients send a DHCP request to the gateway capable of providing the better connection and end their lease with their current DHCP server, or
the clients keep their assigned IP from the DHCP server and (magically?) start accessing the internet through the gateway capable of providing the better connection.
Neither of these scenarios are happening. If for whatever reason the gateway providing the internet to a client drops, the client will not attempt to create a new connection until the DHCP lease times out. However this is contradictory to what is claimed on the wiki for this package: https://www.open-mesh.org/projects/batman-adv/wiki/Gateways
Please advise on how to configure this mesh network so that either one of the expected behaviours will happen.
This is exactly the expected behavior at the IP layer.
If a DHCP server provides a default gateway, that gateway remains in place for the life of the lease. The DHCP client, by design, cannot definitively determine if the default gateway is down.
DHCP is a poll-based protocol; a DHCP server cannot proactively change the parameters of a lease until the DHCP client requests an update. The instructions in the link of your question indicates that (emphasis added):
To inform clients possessing a valid DHCP lease about a gateway
change (the link quality to the gateway could have dropped or the
client is roaming around) batman-adv will also inspect incoming DHCP
renewal packets. If their destination is not the currently selected
gateway and below a certain TQ threshold (currently defaulting to a TQ
of 50), the DHCP renewal packet is not forwarded, thereby forcing the
client to request a new DHCP lease from a better-connected gateway.
Note that the change happens by inspecting incoming renewal packets. Due to the nature of DHCP, you are stuck waiting for a lease renewal request to update the gateway.
You can set low lease times to increase the polling rate, but if you need real-time reaction to failed gateways, you will need to employ an actual routing protocol.

what makes a udp socker server or client

A udp sever can receive and send udp messages.
A udp client can receive and send messages.
So what makes a client and what makes a server
Is the server the side who initiates the first message or the side which does the binding on the socket or both ?
The server always serves client requests. By definition. This means (from this follows) that the client always sends the first message (request). To be able to receive messages, the server binds a socket. Socket binding is an instruction for the operating system to reserve a specific (local) port for your process (it does not matter if the server or client).
UPDATE #1
So SERVER must perform bind() but CLIENT can perform bind(). If you need to identify if the code is a SERVER you should check if this code perform bind() and recv() or recvfrom() BEFORE performing send() or sendto().

Does every topic subscription imply a separate TCP connection?

Does Solace support the idea of a client having multiple topic subscriptions that are multiplexed over a single tcp connection?
Yes, you can run multiple topic subscriptions over the same Solace session which connects to one Solace appliance's host and port. Most middleware providers implement this multiplexing however.

What are the equivalent of TCP Client and TCP Server for Swift

Hi I am a newbie in iOS and Swift. I did some search on internet and i could not find a definite answer to my quest. I found socket.io but this is web socket.
Can you help and tell me the equivalent of TCP Client and TCP server for iOS for Swift 3.
I have these questions
If I use the iOS-base equivalent TCP client to send a message to server
1) On server-side, can I use other TCP Server to return message? any issue?
Thanks
I highly recommend to use Http request to send request to server and get a response from server, for more info check this question.And also to send data to client from server directly send a push notification to client.
However look at this link for tcp communication.

How socks protocol is working

Currently I need to implement socks client. According RFC, Socks protocol has two main commands: CONNECT and BIND. CONNECT is used to forward an outbound connection from socks' client to desired Server. BIND is used to forward an inbound connection from desired Server to socks' client.
My client work as follows:
Firstly It makes connection to socks Server, let us call it a "client connection".
After that it issues commands.
I have some misunderstanding with a "client connection" utilisation. Hence, I have the following questions:
A "client connection" could be used only for one CONNECTION command, is that right ? So for each desired communication I need to create a new "client connection" and after that issue command CONNECT.
For BINDing, firstly, i need to issue CONNECT and after issue command BIND. These commands must be issued in a one "client connection", am I right ?
How many inbound connections socks server could receive on BIND socket ? Only one ?
How traffic flows in case of BIND is used ? We have a "client connection" to socks server. For the "client connection" socks server has one connection to desired server and one incoming connection from desired server. Hence, socks server could receive data from two connections. How this traffic is mixed to the "client connection"?
Yes.
No. BIND is separate from CONNECT. It is for when you want to listen, so you tell the server to listen on your behalf and tell him what port you're listening on.
Pass.
There is only one connection between the client and the SOCKS server. Everything arriving from the client is sent to the 'desired server'. Everything arriving from the 'desired server' is sent to the client. There is nothing to mix. You wouldn't want the client's sends to be sent back to him, would you?

Resources