473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[c# form] Readline sockets, telnet

77 New Member
Hi, I need to be able to get some data from a telnet session to verify a login. There server I wish tot telnet with is a SMTP server. I already have code in place to send commands to the server and to allow me to connect to it via sockets.

So far the only thing I have come up with is:
Expand|Select|Wrap|Line Numbers
  1.             //s being my open socket...
  2.             Stream q = new NetworkStream(s); 
  3.             StreamReader sr = new StreamReader(q);
  4.             string output = sr.ReadLine();
  5.  
However, this freezes when it trys to ReadLine();. Would someone be able to give me a push in the right direction? Ive done some Google searches but they all seem to do it the same or similar ways. And each way I try still freezes. VS2003 output windows has the reply from the server so I know there is a reply there I just can’t get at it.

All help is much appreciated.

Thanks,
Piercy
Oct 23 '07 #1
2 2561
Plater
7,872 Recognized Expert Expert
It might be waiting for the sequence of "\r\n" and your server might only be returning "\n".
I would suggest reading one byte (character) at a time and building your own string from it. That way when a '\n' comes down, you know you have a complete "line"

(Note: I said one byte at a time but if you're comfortable with byte[] you can do that too and just index through them to find a '\n' if you want)
Oct 23 '07 #2
piercy
77 New Member
You was right... it was waiting for \n(\r) i was just about to reply back saying i fixed it. does anyone know how i can just get the auth types back? i can do ehlo and its in the list but ifi just want it in a single line?


I'll keep googleing about this anyway :)

thanks,
Piercy
Oct 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Guy | last post by:
Ok this is might take some exsplaining as this is just example code, I have a telnet server which I've created, its ment to be a a process queue control thing. One of the things I think that would...
3
by: Mike Monaghan | last post by:
I'm rather new to python but a long time programmer. I think I've covered my bases so I hope this isn't somthing obvious. I'm running ActiveState PythonWin 2.3.2 (#49, Nov 13 2003, 10:34:54) ...
2
by: brendonlam | last post by:
Hi there, Hoping someone could advise me here pls; I'm creating a C# class that implements a telnet client socket allowing a VB . NET application to communicate with telnet servers. After...
0
by: Jack | last post by:
I am trying to develop a simple telnet client in MS.NET I have a small wrapper around the System.Net.Sockets.Socket class which takes care of sending and receiving data and handing it off to a...
3
by: Terry Olsen | last post by:
I'm wondering if a winsock class has been written that functions similar to the winsock.ocx from VB6.
10
by: altaf.sunesara | last post by:
Hello ! I have some devices which communicate trough LAN to the server the old form i was using was FTP as a communication between Server and Client i have decided to use personal TCP sockets...
7
by: Roemer | last post by:
Hi all I stumbled over a new problem: I have a programm with just a class that is asynchronous listening for network connections. As soon as someone connected, a new form needs to be created....
3
by: derSchweiz | last post by:
Hi, Experimenting with sockets, and I think I got it half working. I have the following code: Private Sub socket_receive(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
2
by: b00x | last post by:
Hi, I'm trying to develop a script that I can reuse to run remote commands on multiple UNIX servers via telnet. I've tried various php scripts after googling for a good 5 or so hours, but found...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.