Jump to content
Sign in to follow this  
CHronologist

Network Communication

Recommended Posts

I browsed the forum several times but found nothing like my problem. I was trying to write a simple application that should be able to communicate through the network. So I have to programms and each transmitts his data to the other one. I tried a lot, but nothing worked. Router port is forwarded. Here my idea how it was intended:

Server

UDPStartup()
$socket = UDPBind($IP, $port)
Do
    $clientip = UDPRecv($socket, 1024)
until $clientip <> ""
$connection = UDPOpen($clientip, $port)
UDPSend($connection, "ok")

Client

UDPStartup()
$socket = UDPOpen($IP, $port)
$connection = UDPBind(_GetIP(), $port)
UDPSend($socket, _GetIP())

The idea was to start the Server, this opens a socket, waits for an incoming file. Then you start the Client, that creates a connection and an open socket, then transmitts his IP to the Server, so that the Server can establish a connection to the Client. Sending data from the Client to the Server works, but not the oter direction. Thanks for every constuctive comment.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...