
-----------------------------------
supaphreek
Sun May 30, 2010 8:53 am

Sending integers through the internet
-----------------------------------
What is it you are trying to achieve?
I am trying to send integers through the internet.


What is the problem you are having?
It wont receive it :S It says unknown net error.

Describe what you have tried to solve this problem
Tried sending it normally and got the error :S. Tried converting it to string, then to char, then sending the char, and converting the char to a string and then to an int :P (but i want it to be shorter)


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Sending File


const chatPort : int := 55287
var netStream : int
var netAddress : string := ("ip address here")
var d : int

            netStream := Net.WaitForConnection (chatPort, netAddress)

        Draw.Cls
        put "Connected to ", netAddress
        
var d : int := 0
        
        View.Set ("noecho")
        loop
        
                d := d+1
                put : netStream, d
                exit when d = 400
        
        end loop




Receiving file

const chatPort : int := 55287
var netStream : int
var netAddress : string := ("Ip Address")
var d : int

netStream := Net.OpenConnection (netAddress, chatPort)

View.Set ("noecho")
loop
    if Net.CharAvailable (netStream) then
    
        get : netStream, d
        put d
        
    end if
end loop




Please specify what version of Turing you are using
4.1.1

-----------------------------------
Tony
Sun May 30, 2010 11:27 am

RE:Sending integers through the internet
-----------------------------------
Where does the error occur? Do you change your netAddress?

You are still trying to send/receive an integer, while the Net. module checks only if there's a character, line, or some bytes available.

Documentation -- [tdoc]netmodule[/tdoc]

-----------------------------------
supaphreek
Sun May 30, 2010 4:50 pm

RE:Sending integers through the internet
-----------------------------------
But since d is continously changing in the send program, i want it to keep receiving the new value :S

so woudlnt it hvae to be in the loop?
