Sign in to follow this  
Followers 0
CHronologist

Network Communication

4 posts in this topic

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



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

Share this post


Link to post
Share on other sites

$comm = UDPRecv($connection, 1024)

Something like that what I posted was just the initiation part of the connetions.

Share this post


Link to post
Share on other sites

ok problem found, seemed like I used wrong sockets while using TCP functions. delete or close or so

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  
Followers 0