[zeromq-dev] Problem with multiple sockets under Windows: Address already in use
Seref Arikan
serefarikan at kurumsalteknoloji.com
Mon Jun 20 16:12:03 CEST 2011
Thanks Martin,
With the following modified code below (assuming I'm doing the error
handling right), I get no errors at all I just get the "Assertion
failed: Address already in use (..\..\..\src\mailbox.cpp:305)" output
in the command prompt.
//-----------------------------------------------------------------------------
int _tmain(int argc, _TCHAR* argv[])
{
for(int i = 0; i < 1000; i++){
void *context = zmq_init(1);
if(context == 0)
printf("%d\n",zmq_errno());
void *socket = zmq_socket(context, ZMQ_REQ);
if(socket == 0)
printf("%d\n",zmq_errno());
int connectResult = zmq_connect(socket,"tcp://127.0.0.1:5560");
if(connectResult < 0)
printf("Connect result: %d\n", zmq_errno());
//do nothing with the socket
int closeResult = zmq_close(socket);
if(closeResult < 0)
printf("Close result: %d\n", zmq_errno());
int terminateResult = zmq_term(context);
if(terminateResult < 0)
printf("Terminate result: %d\n", zmq_errno());
}
return 0;
}
//-----------------------------------------------------------------------------
On Mon, Jun 20, 2011 at 2:36 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> Hi Seref,
>
>> #include "ZMQTests.h"
>>
>> int _tmain(int argc, _TCHAR* argv[])
>> {
>> for(int i = 0; i< 1000; i++){
>> void *context = zmq_init(1);
>> void *socket = zmq_socket(context, ZMQ_REQ);
>> zmq_connect(socket,"tcp://127.0.0.1:5560");
>> //do nothing with the socket
>> zmq_close(socket);
>> zmq_term(context);
>> }
>>
>> return 0;
>> }
>
> What's the error? I doesn't seem you are cheking the error codes. Is it an
> access violation or what?
>
> Martin
>
More information about the zeromq-dev
mailing list