Select Git revision
Win32SocketLecroy.cpp
-
Alain BUTEAU authoredAlain BUTEAU authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Win32SocketLecroy.cpp 9.24 KiB
//*******************************************************************************
//* Copyright (c) 2008-2014 Synchrotron SOLEIL
//* All rights reserved. This program and the accompanying materials
//* are made available under the terms of the GNU Lesser Public License v3
//* which accompanies this distribution, and is available at
//* http://www.gnu.org/licenses/lgpl.html
//******************************************************************************
//******************************************************************************************
//
//
// september 13, 2004 : Source file for the communication in socket mode
//
// with a Lecroy scope (avaiable for all models)
//
// author : X.Elattaoui
//
// SocketLecroy.cpp: implementation of the SocketLecroy class.
//
//******************************************************************************************
static int hSocket;
static int sTimeout = 15;
//static int sWinsockInitFlag = FALSE;
static char sCurrentAddress[256];
static int sConnectedFlag = false;
const int CMD_BUF_LEN = 8192;
static char sCommandBuffer[CMD_BUF_LEN];
//- INCLUDE
#include "SocketLecroy.h"
//- init of the static instance
SocketLecroy* SocketLecroy::SL_instance = 0; //- ptr on the SocketLecroy instance
SocketLecroy* SocketLecroy::get_instance()
{
if( !SL_instance )
SL_instance = new SocketLecroy();
return SL_instance;
}
void SocketLecroy::delete_instance(SocketLecroy* SL_instance)
{
if(SL_instance)
{
delete SL_instance ;
SL_instance = 0;
}
}
//- CTOR
SocketLecroy::SocketLecroy()
{
sConnectedFlag = false;
}
//- DTOR
SocketLecroy::~SocketLecroy()
{
TCP_Disconnect();
}
//- Build the connection
void SocketLecroy::TCP_Connect(char *ip_address) throw (lecroy::SocketException)
{
SOCKADDR_IN serverAddr;
int sockAddrSize = sizeof (SOCKADDR), result;
const int resp = 1;
fd_set wr_set = {1, {0}};
TIMEVAL tval;