Subj : WinSock
To   : Nightfox
From : Jon Justvig
Date : Mon Jun 11 2018 05:56 pm

 Re: WinSock
 By: Nightfox to Jon Justvig on Mon Jun 11 2018 10:00 am

JJ>> Here's my code, trying to output using a socket:

JJ>> char c;
JJ>> std::fstream myStream("welcome.txt", std::fstream::in);
JJ>> while (myStream.get(c))
JJ>> {

JJ>> send(clientSocket, (const char*)c, size_t(0), 0);
JJ>> std::cout << c;

Ni> Where/how is clientSocket declared? And has it been set up with a valid
Ni> socket handle? That isn't shown in your code snippet. It looks like this
Ni> code is reading from a text file and trying to send each character from
Ni> the file over a socket?

SOCKET clientSocket = accept(listening, (sockaddr*)&client, &clientSize);

I intend to read a text file and have it sent to the client through the socket.

Ni> Also, did you intend for the "std::cout << c" to be indented? It doesn't
Ni> need to be, as it's not in a separate block of code.

Indentations has no meaning in source code except cosmetically.

Sincerely,
Jon Justvig
Stepping Stone BBS
telnet://vintagebbsing.com:2325
http://vintagebbsing.com:81

---
� Synchronet � Stepping Stone BBS - vintagebbsing.com:2325