Sponsored Content
Top Forums Programming How to program a telnet client? Post 13361 by thinker130 on Wednesday 16th of January 2002 03:08:22 AM
Old 01-16-2002
the source file(the second half tel_cli.c and tel_cli.h)

case WONT:
break;
case SB:
printf("ch is SB\n");
sleep(5);
if (lcOption == TSPEED)
{
printf("RECV IAC SB TERMINAL SPEED SEND (32)\n");
printf("%d%d%d\n", rbuf[i], rbuf[i + 1], rbuf[i + 2]);
//i = i + 3;
sleep(5);
bzero(gsSendMsg, LINELEN);
sprintf(gsSendMsg, "%c%c%c%c%d%d%d%d%c%c\n", IAC, SB, TSPEED, IS, 38400 >> 8, (38400 & 0xFF), 38400 >> 8, (38400 & 0xFF), IAC,SE);
write(li_sock, gsSendMsg, strlen(gsSendMsg));
}
if (lcOption == NEW_ENVIRON)
{
printf("RECV IAC SB NEW-ENVIRON SEND (39)\n");
printf("%d%d%d\n", rbuf[i], rbuf[i + 1], rbuf[i + 2]);
//i = i + 3;
sleep(5);
bzero(gsSendMsg, LINELEN);
sprintf(gsSendMsg, "%c%c%c%c%c%c\n", IAC, SB, NEW_ENVIRON, IS, IAC, SE);
write(li_sock, gsSendMsg, strlen(gsSendMsg));
}

if (lcOption == TERMINAL)
{
printf("RECV IAC SB TERMINAL TYPE SEND (24)\n");
printf("%d%d%d\n", rbuf[i], rbuf[i + 1], rbuf[i + 2]);
//i = i + 3;
sleep(5);
bzero(gsSendMsg, LINELEN);
sprintf(gsSendMsg, "%c%c%c%c%s%c%c\n", IAC, SB, NEW_ENVIRON, IS,"ANSI", IAC, SE);
write(li_sock, gsSendMsg, strlen(gsSendMsg));
printf("okokok\n");
bzero(gsSendMsg, LINELEN);
sprintf(gsSendMsg, "%c%c%c\n", IAC, DODO,ECHO_ON);
write(li_sock, gsSendMsg, strlen(gsSendMsg));
printf("okokok\n");
}
i = i + 3;
break;

default:
printf("ch is other character\n");
break;
}

}
else
{
//printf("ch isn't IAC, there are maybe some errors occur!\n");
i++;
}
}
}
}



tel_cli.h:

//telnet command code
#define IAC 255
#define DODO 253
#define DONT 254
#define WILL 251
#define WONT 252
#define SB 250
#define SE 240
#define IS '0'
#define SEND '1'
#define INFO '2'
#define VAR '0'
#define VALUE '1'
#define ESC '2'
#define USERVAR '3'

//option name and id
#define ECHO_ON 1
#define GO_AHEAD 3
#define STATUS 5
#define TIMER 6
#define TERMINAL 24
#define NAWS 31
#define TSPEED 32
#define FLOW 33
#define LINEMODE 34
#define XDISPLOC 35 // X Display Location
#define OLD_ENVIRON 36 // Old - Environment variables
#define AUTH 37
#define NEW_ENVIRON 39
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using telnet client from MacOSX's command line terminal

I'm completely new to Unix, but familiar with Mac OSX. I've just discovered the command line terminal feature of this new OS and I'm trying to learn how to telnet into my host's server to change permissions to allow executable cgi scripts for my website. Is there anyone who might be able to... (2 Replies)
Discussion started by: tylerl
2 Replies

2. Programming

Telnet client IP determination

I have configured my firewall to allow only five remote IP's to connect to my server. Upon connection...i would like to automate the Xsession functions for authorized IP's. Mainly, $DISPLAY of the environment to the client. I understand that the "gethostbyaddr" function is capable of this.... (0 Replies)
Discussion started by: thomas.jones
0 Replies

3. Programming

Does Telnet client library exist ?

Hello, I'm new user in this forum, and i'm french ... so excuse me for my english :) In fact, I've to manage several network equipments which can be only configured with the telnet protocol. But using the standalone telnet tool, it's too long and hard. So I'd like to known if a Telnet... (0 Replies)
Discussion started by: aho
0 Replies

4. UNIX for Dummies Questions & Answers

IP address of telnet client

Hi, I am using the telnet client on windowsNT to access the Unix system. I want to find out the IP address of the telnet client from the server side. The reason is I want to set the DISPLAY environment variable when the user is logged on. Is there anyway that the the Unix server can... (1 Reply)
Discussion started by: vtran4270
1 Replies

5. UNIX for Dummies Questions & Answers

how to launch program though telnet

I have launched telnet on nt and have connected to a unix server, I'm trying to run a program on the unix server which will launch a gui, but when I try to launch it I get the message "display not set\n" "By default set it to 0.0" I can sit down at the unix machine and launch the program with... (3 Replies)
Discussion started by: cbachman
3 Replies

6. Programming

Client - server program

i came acors this coding when surfin the net.this code works perfectly.but as i am new to this socket programming i need sm coments quoted on it or explanation regarding this source code. i have prb understanding the server.c i have posted it below can u guys help me !!!! cheerZ The... (4 Replies)
Discussion started by: mathu
4 Replies

7. Programming

Server client program

hi guys, I need the code for a server client registration form.The server must ask for authentication .Then the client would send in data. This is stored in a file .The server sends back a receipt to the client as part of the payment done. plz can some 1 get me the code... (9 Replies)
Discussion started by: pip3r
9 Replies

8. Programming

SFTP client program

can u help me? i need the program code in C to perform Simple File Transfer in linux.in this forum i found the server program,inw i need the client program ASAP. Thanx. (1 Reply)
Discussion started by: harshi
1 Replies

9. UNIX for Advanced & Expert Users

difference between logging into unix through f-secure ssh client and telnet

hi, what is the difference between logging into unix through f-secure ssh client and telnet is there any more security check is involved can any one explain thanks in advance (1 Reply)
Discussion started by: trichyselva
1 Replies

10. Linux

telnet client and logs

Hello everyone. I have a script that telnets into a linux workstation and restarts a service, while logging the session to a file. I'm kind of new to linux so when I was using windows I would capture something like windows cli: telnet xxx.xxx.xxx.xxx -f c:/capture.log ... # /sbin/service... (3 Replies)
Discussion started by: Elyas_cr
3 Replies
Deprecated names(3)						      BrlAPI						       Deprecated names(3)

NAME
Deprecated names - Data Structures struct brlapi_writeStruct Macros #define brlapi_settings_t brlapi_connectionSettings_t #define BRLAPI_WRITESTRUCT_INITIALIZER BRLAPI_WRITEARGUMENTS_INITIALIZER #define brl_keycode_t brlapi_keyCode_t #define brl_type_t brlapi_packetType_t #define BRLCOMMANDS NULL #define BRL_KEYCODE_MAX BRLAPI_KEY_MAX #define brlapi_initializeConnection brlapi_openConnection #define brlapi_getTty brlapi_enterTtyMode #define brlapi_getTtyPath brlapi_enterTtyModeWithPath #define brlapi_leaveTty brlapi_leaveTtyMode #define brlapi_unignoreKeyRange brlapi_acceptKeyRange #define brlapi_unignoreKeySet brlapi_acceptKeySet #define brlapi_getRaw brlapi_enterRawMode #define brlapi_leaveRaw brlapi_leaveRawMode #define brlapi_suspend brlapi_suspendDriver #define brlapi_resume brlapi_resumeDriver #define BRLERR_SUCCESS BRLAPI_ERROR_SUCCESS #define BRLERR_NOMEM BRLAPI_ERROR_NOMEM #define BRLERR_TTYBUSY BRLAPI_ERROR_TTYBUSY #define BRLERR_DEVICEBUSY BRLAPI_ERROR_DEVICEBUSY #define BRLERR_UNKNOWN_INSTRUCTION BRLAPI_ERROR_UNKNOWN_INSTRUCTION #define BRLERR_ILLEGAL_INSTRUCTION BRLAPI_ERROR_ILLEGAL_INSTRUCTION #define BRLERR_INVALID_PARAMETER BRLAPI_ERROR_INVALID_PARAMETER #define BRLERR_INVALID_PACKET BRLAPI_ERROR_INVALID_PACKET #define BRLERR_CONNREFUSED BRLAPI_ERROR_CONNREFUSED #define BRLERR_OPNOTSUPP BRLAPI_ERROR_OPNOTSUPP #define BRLERR_GAIERR BRLAPI_ERROR_GAIERR #define BRLERR_LIBCERR BRLAPI_ERROR_LIBCERR #define BRLERR_UNKNOWNTTY BRLAPI_ERROR_UNKNOWNTTY #define BRLERR_PROTOCOL_VERSION BRLAPI_ERROR_PROTOCOL_VERSION #define BRLERR_EOF BRLAPI_ERROR_EOF #define BRLERR_EMPTYKEY BRLAPI_ERROR_EMPTYKEY #define BRLERR_DRIVERERROR BRLAPI_ERROR_DRIVERERROR Detailed Description With version 0.5.0, BrlAPI is now provided through including <brlapi.h> and got a big renaming pass. Old names are still available through macros, but they are deprecated since they will get dropped in the next release. This documentation is for you to know the new names. For checking that you have completely switched to new names, just define BRLAPI_NO_DEPRECATED: that will disable compatibility macros. Macro Definition Documentation #define BRL_KEYCODE_MAX BRLAPI_KEY_MAX #define brl_keycode_t brlapi_keyCode_t #define brl_type_t brlapi_packetType_t #define brlapi_getRaw brlapi_enterRawMode #define brlapi_getTty brlapi_enterTtyMode #define brlapi_getTtyPath brlapi_enterTtyModeWithPath #define brlapi_initializeConnection brlapi_openConnection #define brlapi_leaveRaw brlapi_leaveRawMode #define brlapi_leaveTty brlapi_leaveTtyMode #define brlapi_resume brlapi_resumeDriver #define brlapi_settings_t brlapi_connectionSettings_t #define brlapi_suspend brlapi_suspendDriver #define brlapi_unignoreKeyRange brlapi_acceptKeyRange #define brlapi_unignoreKeySet brlapi_acceptKeySet #define BRLAPI_WRITESTRUCT_INITIALIZER BRLAPI_WRITEARGUMENTS_INITIALIZER #define BRLCOMMANDS NULL #define BRLERR_CONNREFUSED BRLAPI_ERROR_CONNREFUSED #define BRLERR_DEVICEBUSY BRLAPI_ERROR_DEVICEBUSY #define BRLERR_DRIVERERROR BRLAPI_ERROR_DRIVERERROR #define BRLERR_EMPTYKEY BRLAPI_ERROR_EMPTYKEY #define BRLERR_EOF BRLAPI_ERROR_EOF #define BRLERR_GAIERR BRLAPI_ERROR_GAIERR #define BRLERR_ILLEGAL_INSTRUCTION BRLAPI_ERROR_ILLEGAL_INSTRUCTION #define BRLERR_INVALID_PACKET BRLAPI_ERROR_INVALID_PACKET #define BRLERR_INVALID_PARAMETER BRLAPI_ERROR_INVALID_PARAMETER #define BRLERR_LIBCERR BRLAPI_ERROR_LIBCERR #define BRLERR_NOMEM BRLAPI_ERROR_NOMEM #define BRLERR_OPNOTSUPP BRLAPI_ERROR_OPNOTSUPP #define BRLERR_PROTOCOL_VERSION BRLAPI_ERROR_PROTOCOL_VERSION #define BRLERR_SUCCESS BRLAPI_ERROR_SUCCESS #define BRLERR_TTYBUSY BRLAPI_ERROR_TTYBUSY #define BRLERR_UNKNOWN_INSTRUCTION BRLAPI_ERROR_UNKNOWN_INSTRUCTION #define BRLERR_UNKNOWNTTY BRLAPI_ERROR_UNKNOWNTTY Author Generated automatically by Doxygen for BrlAPI from the source code. Version 1.0 Fri Jun 7 2013 Deprecated names(3)
All times are GMT -4. The time now is 03:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy