Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 09-19-2008, 05:51 PM   #1
Site Team
 
David Lindon's Avatar
 
Join Date: Dec 2002
Posts: 15,233
Default Sending commands to a socket

I'm trying to write an SMTP wrapper and I'm connecting to the mail server with winsock and connect successfully but how do I send the commands?

send(lhSocket,"HELO\\r",strlen("HELO\\r"),0);

Does it need to be \n to end the command?
__________________

__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 09-20-2008, 12:58 PM   #2
Beta Member
 
Join Date: Sep 2008
Posts: 3
Default Re: Sending commands to a socket

I'm connecting to the mail server with winsock and connect
__________________

newtech2009 is offline   Reply With Quote
Old 09-22-2008, 05:13 AM   #3
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: Sending commands to a socket

it depends on the language that you are using
if you were using VB...
VB uses the syntax Winsock1.SendData("HELO")

You'd need to add carriage return line feeds as well.


but I can see that you are using C, and the code is.
just cause I feel it makes it easier to debug,
Code:
msgString = "HELO\r\n";
msgStringLen=strlen(mgsString); /* Determine input length */
/* Send the string to the server */
if (send(sock,msgString,msgStringLen, 0) !=msgStringLen)DieWithError("send() sent a different number of bytes than expected");
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 11:55 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0