Jump to content

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.

Link to comment
Share on other sites

I do not see a UDPRecv for the client

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...