FireBird34 has asked for the wisdom of the Perl Monks concerning the following question:

Messing with the IO::Socket::INET module here, and ran into some issues. What I'm basically doing is making some networking tools for my closed network (I can't find any online that do what I require lol). Anyway, this isn't that *big*, but it's something I need to resolve. When I connect to a server program, I need to manually press enter, before being given some data -- how would I do this automatically through the program?

After searching google, I found that '1C' is the hex equivelant of the 'RETURN' key, so I tried:

$sock->send(0x1C);

This did not return what I wanted (spit out a numeric value instead of sending the effects of the return key) -- any suggestions?

Replies are listed 'Best First'.
Re: key's -> hex values
by Zaxo (Archbishop) on Feb 08, 2004 at 05:32 UTC

    Not enough information, but Expect may help. In ASCII, 0x1c is FS, the old hardwired field separator. You probably need some Term thing to decode the keyboard.

    After Compline,
    Zaxo

      Ok, thanks -- I'll look into this.

      I think I have it figured out though; I was able to modify the code a bit to *skip* that step :)
Re: key's -> hex values
by ysth (Canon) on Feb 09, 2004 at 04:02 UTC
    If you want the character whose ordinal value is 0x1c, say chr(0x1c) -- but 0x1c is nothing to do with the return key AFAICT. Can't speak as to sockets, but a return will be 0x0a or 0x0d or both. You might even see if send("") does what you want.
Re: key's -> hex values
by BUU (Prior) on Feb 08, 2004 at 17:30 UTC
    As to your original problem, a return should either generate a \n, a \r, a \r\n, or some comebination, so try sending one of those.