
-----------------------------------
8749236
Wed Jun 01, 2011 4:21 pm

Need help on the LAN Network Data Transmitting.. Too much Delay(ping)..
-----------------------------------
What is it you are trying to achieve?
I wrote a game with LAN, and i tried to play on LAN, it works well but the delay(ping) is really high...
So i'm trying to lower it down..

PS: LAN = Local Area Network

What is the problem you are having?
The Delay(ping) of LAN is too high..
By the way i'm running 2 games on 1 computer for testing LAN, is that the cause of this problem???


Describe what you have tried to solve this problem
I tried to reduce the size of data i'm sending, i used tons of "get" and "put" command when i'm trying to sent datas through LAN, but after i reduce it(reduced to 6) theres no effect..
The delay is still same, 2 seconds plus.. delay..


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)





procedure LANConnecting (var input : int)

    % set View so it can display normally..
    View.Set ("nooffscreenonly,nocursor")
    % Run a server!!!
    if input = 2 then

        Draw.Text ("Your IP: " + serverAddress, cx - 180, cy + 68, smallFont, brightred)
        Draw.Text ("Server is running.. Waiting for Connections..", cx - 180, cy + 50, smallFont, brightred)
        View.Update
        serverAddress := Net.LocalAddress
        DataTransfer := Net.WaitForConnection (serverPort, serverAddress)

        cls
        % get player name
        Draw.Text ("Please enter your player name, 10 Letters MAXIMUM!!",
            cx - 180, cy + 50, smallFont, brightred)
        Draw.Text ("Enter Here: ", cx - 180, cy + 32, smallFont, brightred)
        locate (17, 39)
        get playerName (1)
        Input.Flush             % prevent too much input..
        cls
        % sent your name..
        SR (1).playerName := playerName (1)
        put : DataTransfer, SR (1).playerName

        % switch the player name first..
        loop
            % check is there data transmitting..
            if Net.LineAvailable (DataTransfer) then
                get : DataTransfer, SR (2).playerName
                playerName (2) := SR (2).playerName
                connected := true
            end if
            % exit if theres datas returned..
            exit when connected
        end loop

    elsif input = 3 then        % connect to a server
        % get the address
        Draw.Text ("Your IP: " + serverAddress, cx - 180, cy + 68, smallFont, brightred)
        Draw.Text ("Please enter the Server Address to connect to..", cx - 180, cy + 50, smallFont, brightred)
        Draw.Text ("Enter here:", cx - 180, cy + 32, smallFont, brightred)
        locate (17, 39)
        get serverAddress
        cls
        Draw.Text ("Attempting to connect to " + Net.HostNameFromAddress (serverAddress), cx - 180, cy + 50, menuFont, brightred)
        % get the first data..
        DataTransfer := Net.OpenConnection (serverAddress, serverPort)
        % check the connection, failed or not..
        if DataTransfer 