Can I use Winsock to communicate between two process on the same computer
but without network card???
> Can I use Winsock to communicate between two process on the same computer
> but without network card???
You don't need a network card to install a Microsoft Loopback adapter
then you have a local NIC driver without a NIC. At that point you could
simply use WinSock as documented and connect to localhost (better) or
the assigned IP address on the Loopback adapter. I mention this method
only because I suspect (but don't actually know) th...sockets
I am using CSockets to design a simple chat server/client. The client is
able to send messages to the server but fails to receive anything back. Here
is the code for the client that I have put in a while loop:
char echoBuffer; // Buffer for echo string
int recvMsgSize; // Size of received message
recvMsgSize = client.Receive(echoBuffer, 256, 0);
This causes the debugger to prompt for a Debug Assertion Failure then it
gives me the option to shutdown the client.
Why is this happening?
Jessica Weiner wrote:
> I am using CSockets to desi...timeSetEvent and mfc socket
I'm developing a dll that use a timer. i used timeSetEvent with a
callback function, to send a message every time period using MFC
Sockets. the callback function works well, but when i add the code that
call the send function from it, i get a socket error. [Debug assertion
failed socore.cpp line 566] and when i trace the code i found it in
function CAsyncSocket::AssertValid(). i guess the source of assertion
is that the callback function run in a isolated thread. but i do n't
know how to solve it.
eid mahmoud wrote:
> Hi all,
> I'm developing a...Socket
How can I connect to smtp server?
I tried to use CSocket:
but there is an error during connecting to server.com (function Connect
Thx for help me
"ArtuS" <email@example.comNOSPAM> wrote:
>How can I connect to smtp server?
>I tried to use CSocket:
>but there is an error during connecting to server.com (function Connect
Have you called GetLastError to find out wha...UIThread and Socket ?!? (socket works fine but....)
i have written an littel application with a UIThread. In this thread i create a Socket, to receive any msg
If the CAsyncSocket::OnReceive() fired, i read IN THE SOCKET-CLASS the incomming Data. After thi
i call the Thread with PostThreadMessage() to process the Data
When the Thread is working and a NEW data-msg is comming up, the Socket read it exactly !!. But the PostThreadMessage() call in my SockteClass is without reason. Also the Thread don´t get the Message !
How can i solve the problem
thx in advanc
I'm not sure what you mean by the questions. What do you mean ...Asynchronous Sockets Client
I'm trying to create an Asynchronous Client using the sample code from MSDN
My problem is that if the connection is refused, e.g. the server is not
started. I have no way of knowing this!
How do I return some kind of status from an async method?
In the main form
MyClient vision = new MyClient();
// here I don't know if the connection is OK or not
// Async socket client class
private static ManualResetEve...Using Sockets
I am using the CAsyncSocket class and I want my write operations to block.
How can I set this parameter?
Use CSocket, which simulates a blocking socket and is derived from
But be warned that there are some very polarized views out there as to
whether CSocket is just fine or is instead the source of all evil.
"Chris Baker" <ChrisBaker@discussions.microsoft.com> wrote in message
> I am using the CAsyncSocket class and I want my write operations to block.
> How can I set this parameter?
...Socket and multicast...
I am using VC++.Net and CAsyncSocket class.
I am writing an application connected to 2 networks :
The company network with DNS and network services
A private local area network with no DNS ans servers but computers on
some multicast groups
I send a multicast request to the private local network but the frame is
sent on the company network and not on the private network.
What I tried :
I set DONT_ROUTE and NO_BROADCAST on the opened socket of the local
I tried to open on the same UDP port on the company network and shutdown
Thank you for help in advanc...System.Net.Sockets.Socket question
I have an application that accepts an existing socket connection
(passed to it by the server that actually accepted the incoming
connection), and I'm trying to find a way to have the application NOT
close the socket when it terminates.
So basically what I've done is created a class that inherits from
System.Net.Sockets.Socket. In the .NET source code I can see that the
Dispose() method closes the socket if it is still open, so my first
thought was to override the Dispose() method and leave out the socket
closing portion of the code. This failed, so maybe my understanding
o...Robust Server using Sockets
I want to develop a server application which can handle 1 million
clients. I plan to use asynchronous tcp/ip sockets to handle clients.
The communication is not frequent and the data transfered is also
less(Max 100kb packet)
I have some ideas to implement it
1. To have a single server which will service all the 1 million
clients. Server will listen to the connections on a particular port
and once connected will keep the connection open forever.
2. To have a single server which will service all the 1 million
clients. Server will send data in one port and receive data in other
port. Onc...Socket probem,GetLastError returns 10038 (Invalid socket handle)
I am implementing SMTP protocol in MFC using Sockets.
I am using the CSMTPConnection v1.36 code provided by PJ Naughter
The problem is while sending mails sometimes mails are not sent.
1)I am connecting ,sending mail and then disconnecting.
The above step is repeated 6 times hence 6 mails should be
sent.Sometimes only 4 or 5 mails are sent.But sometimes all 6 mails are
The problem seems to be while Sending the MAIL command in
The return value of GetLastError() was 10038 i.e Socket operation on
I've made a class CMYSocket that derives from CAsyncSocket.
Does it matter when I call CAsyncSocket(nErrorCode) ? Before or after
calling receive(...) ?
Do I need to add my own check of the nErrorCode variable and stop the object
if there the variable is not equal zero ?
On a few occasions my OnReceive method has been triggered when no data has
acctually been sent. The GetLastError() method returned error code 10054
Connection reset by peer.
An existing connection was forcib...Sockets
Hey everyone. I'm writting a simple chat-like client that uses straight
CSockets (with Cfiles and CArchives of course) and I've run into a bit of a
problem. Initialization and connection run great, the problem is how do I
know if there is data waiting at the socket to be read? Basically if I send
across a message to my server, then call CArchive.readstring() it works
great, however if they are no messages currently waiting, then the program
simply hits an infinite loop :( I know that the method is looping in the
Read method, but I have no idea why.... Okay, so is there someway of t...Protocols used by socket (Datagram)
I know that protocol used by CAsyncSocket (or CSocket) in Datagram
configuration is UDP. I'd like to known the other protocols used during the
communication and principally the initialization or "connection" phase.
Any information making the relation between CAsyncSocket connection steps
and the protocol used would be great! Something like :
1- ARP[Data ...]
2- ARP[Data ...]
3- UDP[Data ...]
4- UDP[Data ...]
Are there any MSDN articles similar in style to "Serial Communications in
Win32" but aimed at sockets/network communications?
Thanks in Advance,
> Are there any MSDN articles similar in style to "Serial Communications in
> Win32" but aimed at sockets/network communications?
> Thanks in Advance,
Scott McPhillips [VC++ MVP]
I need to close a socket and use it immedeiatly again with another local
port. Is it enough to do socket.close() in order to release all resources,
or must I do anything more(like a delete or similar) before I use the "new"
> I need to close a socket and use it immedeiatly again with another local
> Is it enough to do socket.close() in order to release all resources,
Yes, Close() is equivalent to Dispose(). But after you close the
socket, it can't be reused. You have to create a new ins...Sockets in MFC
The project I am working on was set up to support sockets
in the MFC setup. I have a socket class that sets up the
server side of the socket relationship. On a simple
console based app my socket code works. It is
essentially a copy paste from the MSDN socket example
So I took my basic console functionality and am trying to
get it to function through an MFC dialog. When I try to
start the server object so it waits for a client now, the
program locks. I ran the debugger to find the place
where it stops, and compared all the variable states on
the dialog vs the old conso...Sockets and Notification
I have a client/server application talking to each other using streaming
I have a class that is the communication class, which owns the socket,
sends, and receives messages.
Anyway, Lets say I want to call a method in the communication class, tell
it to send a message to the server and wait for a response.
So the client will send a message to the server. Wait for a message from
the server. If it doesn't receive the reply back within 2 or 3 seconds, it
raises an error.
I am having a bit of problem designing the wait part.
Any ideas would be appreciated
Ali...Completely GENERAL specifications for socket notification
I've looked in the MSDN to find out the exact behavior of the On*()
notification functions for CAsyncSocket, but there are many important
things that are not very well described. Can anyone point me to
something that gives a clear and completely general description of how
these notifications work? This is the data I've been able to piece
together so far:
"Notifies this socket that there is data in the buffer for it to
retrieve by calling Receive."
Does this mean that every chance it gets it checks to see in there's
something to be received then calls OnReceive?...Sockets, Am I crazy??
Win2k SP3 Visc Studio 6.0 SP5
Snippet of MFC code, UDP Socket
I create a socket / class
then do the OnReceive(int nErrorCode) method to call receivefrom
For some reason, this event (OnReceive) fires all the time and does not
appear to be just 'bound' to the 9600 port,
which of course brings my app to a crawl because I am continually trying to
parse every packet hitting the card,
not just ones directed on port 9600. Any ideas how to bind the socket to
receive only on port 9600,
I thought Create automatically bound the socket to the port...Socket TimeOut
Can I change the timeout of recieving , sending...?
I tried to use SetSockOpt but nothing happened
"monther" <firstname.lastname@example.org> wrote in message
> Can I change the timeout of recieving , sending...?
> I tried to use SetSockOpt but nothing happened
See documentation for struct linger in MSDN.
I read all documentation about this problem,The problem actually is seriouse
in recieving form someone, if there is no recieved data , the programm will
stop at recieveform...Clearing the data in the socket..
Can anyone tell me how to clear the data in the socket after
Thanx in advance..
"Wallace" <email@example.com> wrote in message
> Can anyone tell me how to clear the data in the socket after
> receiving it??
static const unsigned nRead = (10*4096);
memset( pTmp, 0, nRead );
int nActual = Receive( pTmp, nRead );
I am not sure I understand, calling Receive(...) will remove the data.
if the data is greater than (10...Socket Status
I've been trying to get the status of my socket but I can't seem to succeed.
Basically I have a thread listening to my socket and processing packets,
however when the socket on the other end disconnect I never know about
except I keep getting packet of size 0 bytes.
I tried setsockopt() to set the Socket for SO_KEEPALIVE and used
getsockopt() when data comes in but no luck and I think I read it somewhere
that in Win32 you only get this option after 2 hours timeout.
I tried select() and that did not work either.
So I'm at a dead end with no way to find out the status o...MFC Socket listener
Hello everyone, got a quick question here that hopefully someone can help me
with. Basically I am having trouble with my Client application which uses
MFC CSockets. I currently can only listen to one port (say 4000), and I
need to be able to listen to multiple ports. Originally I just set up two
listeners (one listening on 4000 another on 4200) but the problem with this
is that I need to know which Listener is flagged when I call the OnAccept()
method (actually this method is calling another function
OnProcessPendingAccept() at which point I need to know which listener got
tagged). Basical...SQLConfigDataSource kills socket
I am hoping someone out there can help.
I have a program that communicates with a server program using TCP via
CAsyncSocket. I modified this program to do database queries using ODBC.
What I would like to do is to programmatically set the data source name
using SQLConfigDataSource(). However, everytime I call it the socket
connection gets disconnected.
I wrote a simple stripped down program (not using CAsyncSocket) that
reproduces the problem:
BOOL result = s.Create();
result = s.Connect("localhost", 4000);
result = SQLConfigDataS...