How to connect Julia TCP client socket - sockets

I am learning Julia networking and trying to connect to a server using the Sockets package. I am unable to get a response from the server. Please see my code below.
I have tried to connect to the server using the following function.
using Sockets
function login()
cs = connect("78.129.190.32", 5201)
write(cs, "text string message")
data = read(cs)
println("Received: $data")
end
however I receive no response from the server. Is this how one would connect using tcp sockets?
I have included the package Sockets and verified in Julia terminal.
The host and port work as I have implemented the socket in c#.

Related

Cant we read data from an established port using C# or python?

I used netstat to find which ports are established and I tried to read from an established connection using ip and port. I am getting the following error.
Connection actively refused by the machine
No - you can only create a connection to a listening port. "Established" means there is already a connection between two sockets. You can't add a third socket to an existing connection.
If you want to eavesdrop on the connection, there are ways to do that - on Linux, you can create a SOCK_RAW or AF_PACKET socket to receive all packets. On Windows, you need to install the WinPcap or Npcap driver and use libpcap.
If you are just curious and don't need to intercept the connection from a program, you can also use the open source tool Wireshark to see what data your computer is sending and receiving.

Does Photon Server supports multiple protocol connections?

I need to connect Unity3D client to Photon Server using both UDP and TCP connections. Is it possible? Where can I read about it?
P.S. I want to use TCP to send large amount of data.
Photon server supports multiple protocols simultaneusly. If you downloaded the server sdk
look for the PhotonServer.config:
It contains entries like this
<UDPListeners>
<UDPListener
IPAddress="0.0.0.0"
Port="5055">
</UDPListener>
</UDPListeners>
and
<TCPListeners>
<TCPListener
IPAddress="0.0.0.0"
Port="4530"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000"
>
</TCPListener>
</TCPListeners>
Your clients can connect per udp or tcp and interact with each other no mater what protocol thy have chosen.
For the full set of configuration options you can look here: http://doc.exitgames.com/en/onpremise/current/reference/server-config-settings
When a client connects you can query in your server side application how the client connected like this:
public class YourApplication : ApplicationBase
{
if (initRequest.LocalPort == 5055)
{
//
}
if (initRequest.PhotonPeer.GetListenerType() == ListenerType.TCPListener)
{
//
}
Note: UDPListener in the config are represented as ListenerType.ENetListener in code.
You can find the server sdk documentation in the downloaded {sdk}\doc\Photon.SocketServer.chm or online here http://doc-api.exitgames.com/en/onpremise/current/server/doc/annotated.html
Simple answer: No. A photon server cannot have more than 1 type of connection.
However, there is a way to do this depending on your definition of a 'server.' For the basis of this explanation, lets call a server the object instance running on a machine. The machine the server is running on, we'll call the machine. You can have multiple servers running from a single machine where they can have different types of connections. For instance, you could have the unity client connect to the physics server using a UDP connection and connect the client to whatever else you needed using a TCP connection.
Photon server handle connect object called Peerbase. Each peer is each client connection. In client peer connection you only choose protocol is UDP or TCP.
Solution is create two peers, one is UDP and one is TCP but hard to handle what UDP and TCP peer is in one client to find player info and send data

send data between two server sockets

I have to make an app using C/PHP sockets on linux that sends data from one socket to other socket, like this.
I have server (server_hosted) hosted somewhere with an IP or domain name. It is running web application.
I have another server (unknown_server) running at my home (unknown IP).
Client send some information through web application hosted in server_hosted to another server running at my home (unknown IP).
I need a way to established a connection between server_hosted and unknown_server.
I was able to make connection between both using TCP socket. I made server_hosted as server listen to certain port says 8080 and unknown_server as client, which make open connection to server_hosted.
The problem comes when I have multiple unknown_server at my home. How can I made connection to same port? How many client can TCP/IP support?
Any ides how to make tunnel or connection between server_hosted and unknown_server.
Is possible to do with curl or socket any better ideas?

probable differences using FPGA UCLINUX SOCKET and Python socket

I am working on altera FPGA and have written a client application on uclinux. I have also written server client application in Python. My FPGA Client is able to connect with Python server but it is unable to connect when server is placed on a remote location passing more than one router.
If any one having idea where the probable mistake is and ways to debug the issue

Lua/NSE socket connection problem

I can telnet to a certain host and port no problem and issue commands. However when i try to script a socket connection (using nmap NSE and Lua) to the same host and port, it fails with the following error message:
|_sockettest: Trying to receive through a closed socket
the socket connect part of my code is here:
local msg
local response
msg = "hello\n"
local socket = nmap.new_socket()
socket:set_timeout(150000)
socket:send(msg)
response,data = socket:receive()
return data
I think the data is sending ok. The server should just echo back what i sent. Does anyone know what the problem could be?
You need to call socket:connect before receiving (and before sending). Seriously, read that code you wrote. Where did you specify to whom you're sending ?