Hi,
sorry for not posting it in the first post.
It is connecting the postgresql DB but not getting any data from it using dotnet.
more explanation of the error is
I m using this code where i m getting error
SphinxClient cli = new SphinxClient("localhost", 5433);
//set the pagination params
//(this is page 2, 40 per page, 10000 max)
cli.SetLimits(40, 40, 10000);
// define the query and index
// ("*" means any index)
int q;
q = cli.AddQuery("100", "*");
SphinxResult[] results = cli****nQueries();
cli.GetLastError();
cli.GetLastWarning();
When it is running "SphinxResult[] results = cli****nQueries();" it is giving me the
IOException "Connect: Read from socket failed: Unable to read data from the transport
connection: A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because connected host
has failed to respond."
internally it is calling the TcpClient Connect() method defined in the SphinxClient.cs
file. after reading the "int version = sr.ReadInt32();" code line it going in the catch
block and giving IO Exception
private TcpClient Connect()
{
TcpClient sock;
try
{
//sock = new Socket(_host, _port);
//sock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IPv4);
sock = new TcpClient(_host, _port);
sock.ReceiveTimeout = SPH_CLIENT_TIMEOUT_MILLISEC;
}
catch (Exception e)
{
_error = "connection to " + _host + ":" + _port + " failed: " + e.Message;
return null;
}
NetworkStream ns = null;
try
{
ns = sock.GetStream();
int temp;
temp = sock.Available;
if (sock.Connected)
{
log lg = new log();
lg.logEntry("data available");
}
BinaryReader sr = new BinaryReader(ns);
BinaryWriter sw = new BinaryWriter(ns);
//char[] buf = new char[1024];
//if (size != 1)
// throw new Exception("Connect: Could not read version number from searchd server");
//int version = Convert.ToInt16(buf[0]);
int version = sr.ReadInt32();
if (version < 1)
{
sock.Close();
_error = "expected searchd protocol version 1+, got version " + version;
return null;
}
//sw.Write(VER_MAJOR_PROTO);
}
catch (IOException e)
{
_error = "Connect: Read from socket failed: " + e.Message;
try
{
sock.Close();
}
catch (IOException e1)
{
_error = _error + " Cannot close socket: " + e1.Message;
}
return null;
}
return sock;
}