Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31

Thread: Request Lua Variable from Webserver

  1. #11
    Join Date
    Oct 2005
    Posts
    307

    Default

    What messages are you receiving in the terminal? Are you sure iRule is allowing the connection to stay open?

  2. #12
    Join Date
    May 2001
    Posts
    697

    Default

    This is using telnet and it still echoing and is still open it seems that table maybe issue see my code above

    table print returns { -- #0
    } -- #0
    Rickd

  3. #13
    Join Date
    Oct 2005
    Posts
    307

    Default

    Are you getting the 'new Incoming connection' or any of the other messages from the telnet code?
    If you are getting the new incoming message and not the 'new client connection', just move the clients[p1]=true below the print ("new incoming connection")

  4. #14
    Join Date
    May 2001
    Posts
    697

    Default

    userdata: 06ED79B0
    { -- #0
    [1] = userdata,
    } -- #0
    [string "new1.gml:\New\Scripting"]:16: attempt to index local `i' (a number value)
    stack traceback:
    [string "new1.gml:\New\Scripting"]:16: in main chunk
    I did that and it drops following error printing p1 is userdata: 06ED79B0 above and table print shows user data only so not sure if it loading table correctly

    this error is from this code
    Code:
    for i in clients do
    if (clients[i] ~= nil) then
    i:Write("status update.../r/n")
    end
    end

    printing p1 occurrs in telenet server
    Last edited by rickd; August 21st, 2011 at 07:31 PM.
    Rickd

  5. #15
    Join Date
    Oct 2005
    Posts
    307

    Default

    I don't think you can print the table of connections. What messages are you getting from the telnet code?

  6. #16
    Join Date
    Oct 2005
    Posts
    307

    Default

    Please stop editing previous posts, it makes the thread hard to follow (and some of my comments odd).
    #1 in your first post of the telnet example you have added the line: table.print(clients[p1]). Take it out (I think this is generating the error).
    #2 what messages are you seeing from the code (connection closed, new incoming connection, client connection closed, etc...)?
    #3 are you using iRule to initiate the connection or something else?

  7. #17
    Join Date
    Oct 2005
    Posts
    307

    Default

    your line i:Write("staus update...\r\n") has forward slashes.

  8. #18
    Join Date
    May 2001
    Posts
    697

    Default

    Ok sorry:

    Anwser 2 : I get the following :

    New Incoming Connection
    userdata: 0701A9F8


    Code is now as follows:

    Code:
    function mycbserver(p1,p2)
    
    			if ( p2 == transport.constants.event.CONNECTIONCLOSED ) then
    				print("Connection Closed")
    				return
    			end
    	if ( p2 == transport.constants.event.NEWCONNECTION ) then
    				print("New Incoming Connection")
    				print(p1)
    				clients[p1]=true
    				p1:Callback(transport.constants.parser.TERMINATED,'\n', 3000, function (cp1,cp2)
    		if ( cp2 == transport.constants.event.CONNECTIONCLOSED ) then
    				print("Client Connection Closed")
    				
    				p1:Close()
    				clients[p1]=nil
    				return
    			end
    	if ( cp2 == transport.constants.event.CONNECTIONESTABLISHED ) then
    			print (cp1.."cp1")
    			if ( cp1 == 0 ) then
    				print("New Client Connection")
    				p1:Write("welcome to our echo telnet server!\r\n")
    				--clients[p1]=true
    				
    			else
    				print("New Client Connection Failed: ")
    				p1:Close()
    				clients[p1]=nil
    			end
    		return
    	end
    		print(cp1)
    		
    		p1:Write(cp1 .. '\r\n')
    	end)
    	return
    	end
    end
    if ( clients ) then
    	for c,v in pairs(clients ) do
    	c:Close()
    	end
    end
    if ( c5 ) then
    	c5:Close()
    end
    clients = {}
    	c5 = transport.New(transport.constants.transport.GIPLISTEN)
    if not c5:Open(nil, 12345) then
    	print('Could not start listening')
    	c5:Close();
    	c5 = nil;
    end
    c5:Callback(transport.constants.parser.TERMINATED, '\r\n', 1000, mycbserver)
    print('Listening for connections on port 12345, use telnet localhost 12345 from the commandline')
    anwser 3 : I am using hyperterminal for now all echo is working with it.

    Usering following code :

    Code:
    table.print(clients)
    
    
    for i in clients do
    if (clients[i] ~= nil) then
    i:Write("status update...\r\n")
    end
    end
    returns following in console

    { -- #0
    [1] = userdata,
    } -- #0
    [string "new1.gml:\New\Scripting"]:16: attempt to index local `i' (a number value)
    stack traceback:
    [string "new1.gml:\New\Scripting"]:16: in main chunk
    Last edited by rickd; August 21st, 2011 at 09:24 PM.
    Rickd

  9. #19
    Join Date
    Oct 2005
    Posts
    307

    Default

    I'm taking the easy way out... Instead of trying to find the error, I've just made something that works as requested. Attached is a GML that works for me using hyperterminal connecting to port 8888.
    Attached Files Attached Files

  10. #20
    Join Date
    May 2001
    Posts
    697

    Default

    Thank you very much that works for me too I just need to test with iRule but I would surprised if that did not work.

    awesome!!!
    Rickd

Page 2 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •