locked
Windows Store App - SSL on Streamsocket

    Question

  • I am trying secure socket client on Windows 8 using SSL on Stream socket to connect with smtp server on gmail.

    Once connected with server using  SocketProtectionlevel.ssl, I received connected response ok from the server.

    But after sending "EHLO" message using Datawriter on socket.outputstream, I received   "" 502 unrecognized command ""   on socket.inputstream.

    Do I need to do encrypt this EHLO message using server's key?? If so guide me how to do?

    Monday, March 17, 2014 1:15 PM

Answers

  • Are you double-sure you're passing in the right terminators (\r\n)?  502 is commonly used for when the server simply doesn't understand what's been sent.

    Network Developer Experience Team (Microsoft)

    • Marked as answer by aasikraja Friday, March 21, 2014 5:14 AM
    Monday, March 17, 2014 6:07 PM

All replies

  • Are you double-sure you're passing in the right terminators (\r\n)?  502 is commonly used for when the server simply doesn't understand what's been sent.

    Network Developer Experience Team (Microsoft)

    • Marked as answer by aasikraja Friday, March 21, 2014 5:14 AM
    Monday, March 17, 2014 6:07 PM
  • Yes I am sending "EHLO \r\n" on datawriter.writestring and datawriter.storeAsync on socket.outputstream.

    But I keep receiving "502 5.5.1 Unrecognized command". 

    If I send "EHLO" without "\r\n", no data received from server. datareader will waiting on readcall.




    • Edited by aasikraja Thursday, March 20, 2014 11:53 AM
    Tuesday, March 18, 2014 5:14 PM
  • What response did you get from the server?  And, of course, I assume that when you say you're sending "EHLO \r\n\" that you're actually sending "EHLO\r\n" without a space :-)


    Network Developer Experience Team (Microsoft)

    Thursday, March 20, 2014 5:57 PM
  • Oh -- and per here: http://cr.yp.to/smtp/helo.html#helo -- are you sending in a client name?

    Network Developer Experience Team (Microsoft)

    Thursday, March 20, 2014 5:58 PM
  • Now I am able to receive correct response from the server. The problem is I am mistakenly sending 4 extra byes sent in writer.outputstream. Now I found that and  solved it.

    Thank you all for taking your time for answering my question.

    • Marked as answer by aasikraja Friday, March 21, 2014 5:13 AM
    • Unmarked as answer by aasikraja Friday, March 21, 2014 5:14 AM
    Friday, March 21, 2014 5:13 AM