5 Replies - 7001 Views - Last Post: 24 September 2010 - 08:37 AM Rate Topic: -----

#1 jammmie999   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 117
  • Joined: 01-April 09

C# Sockets Send/Receive Client Data

Posted 24 September 2010 - 12:02 AM

Hey Guys,

I am just wondering why

telnet mail.someserver.com 110
+OK MAILSERVER ready.


Ends on a new line as if it is expecting a user response, but when I use

//Send
mySocket.Send(myByte);

//Recive
Byte[] bRecive = new byte[1024];
int i = mySocket.Receive(bRecive, bRecive.Length, 0);
string sBuffer = Encoding.ASCII.GetString(bRecive);



The response is
telnet localhost 110
+OK ready.



should I send some kind of terminator or line break \r\n when I expect a user input because my app crashes when I enter a keystroke.

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: C# Sockets Send/Receive Client Data

#2 Imdsm   User is offline

  • D.I.C Regular
  • member icon

Reputation: 104
  • View blog
  • Posts: 362
  • Joined: 21-March 09

Re: C# Sockets Send/Receive Client Data

Posted 24 September 2010 - 12:40 AM

that depends, are you running the EXACT same server?
Was This Post Helpful? 0
  • +
  • -

#3 jammmie999   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 117
  • Joined: 01-April 09

Re: C# Sockets Send/Receive Client Data

Posted 24 September 2010 - 07:57 AM

I am not running any specific server. I am trying to create my own server.
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: C# Sockets Send/Receive Client Data

Posted 24 September 2010 - 08:07 AM

If you're developing your own server, then it all depends on what the protocol expects.
Was This Post Helpful? 0
  • +
  • -

#5 jammmie999   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 117
  • Joined: 01-April 09

Re: C# Sockets Send/Receive Client Data

Posted 24 September 2010 - 08:33 AM

View PostJackOfAllTrades, on 24 September 2010 - 04:07 PM, said:

If you're developing your own server, then it all depends on what the protocol expects.

Its has to be POP3 so the server sends the message "+OK ready." and the client sends a authentication command back to the server. But my server disconnects when I enter any character into the telnet window.

This post has been edited by jammmie999: 24 September 2010 - 08:35 AM

Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: C# Sockets Send/Receive Client Data

Posted 24 September 2010 - 08:37 AM

Have you read this tutorial? Obviously the server protocol is different, but the principle is the same. With what little code you've provided it's hard to diagnose any further.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1