[newbie][OFF][Win32][Winsock] reading from and writing to connections



Dear everyone!
I'm new to network programming and I require some help. =)
So I decided to write a little utility similar to netcat as 2nd networking program, and when I'm writing to port 25 (an Exim mailer daemon is sitting on it), it gives me an SMTP code 554 (Synchronization error). I've found out it means I broke the protocol with writing to it before receiveing code 220 (the banner). I'd like to fix it, the problem is I have no idea how to :\. Since it is a generic application, if I used recv(), before sending a command it could be hanging there blocking until the end of time if I used it to connect to another service.

the source: http://pastebin.ca/1014034

screenshot about the error: http://img123.imageshack.us/img123/5176/554lh6.jpg

packets captured with wireshark: http://filebin.ca/oyudtg/mync.pcap

Any help is appreciated.

I know it is offtopic here (as the topic shows) a bit since I am trying this in win32 environment, but since my problem is generic enough I thought I would try it here. Also if you can direct me to the right group, that would be nice too =)
.



Relevant Pages

  • Re: my oscar picks
    ... street and beaten by an angry mob for writing.. ... :What percentage of network programming is based out of LA vs. the East ... Of the sitcoms and soap operas, I would guess that 99.44% of them are ...
    (rec.sport.football.college)
  • Re: Pedants
    ... about clearing the screen, writing to the Windows registry, ... Network programming? ...
    (comp.lang.c)
  • Re: my oscar picks
    ... street and beaten by an angry mob for writing.. ... :What percentage of network programming is based out of LA vs. the East ... Of the sitcoms and soap operas, I would guess that 99.44% of them are ...
    (rec.sport.football.college)