Hello!
*SOLVED*
I am currently developing a program that will recieve frames from a server connected to a webcam. The server seems to be working perfectly by itself. It is running a Asynchronous connect and closes the connection every time it is done sending a frame.
Trobule is in the Client.
Visual Studio C++ 2010
WinXP
Code:
#include <SFML\Network.hpp>
#include <stdio.h>
#include <iostream>
#include <opencv\highgui.h>
#include <opencv\cv.h>
#include "stdafx.h"
#define imageHeight_default 480
#define imageWidth_default 640
int main()
{
IplImage *frame = 0;
int key = 0;
int imageWidth = imageWidth_default;
int imageHeight = imageHeight_default;
sf::SocketTCP Client;
size_t Recieved;
if(!Client.Connect(6117," 138.106.152.147"))
{
std::cout << "Error connecting" << std::endl;
}
else
{
char Buffer[921600];
if (Client.Receive(Buffer, sizeof(Buffer), Recieved) != sf::Socket::Done)
{
std::cout << "Error recieving" << std::endl;
Client.Close();
}
else
{
std::cout << "Data recieved correctly" << std::endl;
Client.Close();
}
}
}
And the output on screen:
Error recieving
The break during runtime links me to line 202 in xutility (from c:\program files\microsoft visual studio 10.0\vc\include\xutility)
Any thoughts?
I am quite new to network programming.
*Update*:
I have minimized the code and searched for the place I get the error. It seems to be in the
sf::SocketTCP Client;
Line
I am baffled since I do the same thing in the server and it works.
*SOLVED*:
Turns out that the error was with the exiting of the program. I used return 1;
and got the error whilst exit(1);
worked.