• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setopt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setopt函数的典型用法代码示例。如果您正苦于以下问题:C++ setopt函数的具体用法?C++ setopt怎么用?C++ setopt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setopt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: network_uncork

/**
 * network_uncork(fd):
 * Set the TCP_NODELAY socket option, and clear TCP_CORK or TCP_NOPUSH if
 * either is defined.
 */
int
network_uncork(int fd)
{

	/* Clear TCP_CORK or TCP_NOPUSH as appropriate. */
#ifdef TCP_CORK
	setopt(fd, TCP_CORK, 0, err0);
#else
#ifdef TCP_NOPUSH
#ifndef BROKEN_TCP_NOPUSH
	setopt(fd, TCP_NOPUSH, 0, err0);
#endif
#endif
#endif

	/* Set TCP_NODELAY. */
	/*
	 * For compatibility with Linux 2.4, this must be done after we
	 * clear TCP_CORK; otherwise it will throw an EINVAL back at us.
	 */
	setopt(fd, TCP_NODELAY, 1, err0);

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}
开发者ID:Tarsnap,项目名称:tarsnap,代码行数:34,代码来源:tsnetwork_cork.c


示例2: nfslib_set_sockbuf

static void
nfslib_set_sockbuf(int fd)
{
	int curval, val;

	val = NFSD_TCP_BUFSZ;

	curval = get_opt(fd, SOL_SOCKET, SO_SNDBUF);
	syslog(LOG_DEBUG, "Current SO_SNDBUF value is %d", curval);
	if ((curval != -1) && (curval < val)) {
		syslog(LOG_DEBUG, "Set SO_SNDBUF  option to %d", val);
		if (setopt(fd, SOL_SOCKET, SO_SNDBUF, val) < 0) {
			syslog(LOG_ERR,
			    "couldn't set SO_SNDBUF to %d - t_errno = %d",
			    val, t_errno);
			syslog(LOG_ERR,
			    "Check and increase system-wide tcp_max_buf");
		}
	}

	curval = get_opt(fd, SOL_SOCKET, SO_RCVBUF);
	syslog(LOG_DEBUG, "Current SO_RCVBUF value is %d", curval);
	if ((curval != -1) && (curval < val)) {
		syslog(LOG_DEBUG, "Set SO_RCVBUF  option to %d", val);
		if (setopt(fd, SOL_SOCKET, SO_RCVBUF, val) < 0) {
			syslog(LOG_ERR,
			    "couldn't set SO_RCVBUF to %d - t_errno = %d",
			    val, t_errno);
			syslog(LOG_ERR,
			    "Check and increase system-wide tcp_max_buf");
		}
	}
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:33,代码来源:nfs_tbind.c


示例3: network_cork

/**
 * network_cork(fd):
 * Clear the TCP_NODELAY socket option, and set TCP_CORK or TCP_NOPUSH if
 * either is defined.
 */
int
network_cork(int fd)
{

	/* Clear TCP_NODELAY. */
	setopt(fd, TCP_NODELAY, 0, err0);

	/* Set TCP_CORK or TCP_NOPUSH as appropriate. */
#ifdef TCP_CORK
	setopt(fd, TCP_CORK, 1, err0);
#else
#ifdef TCP_NOPUSH
#ifndef BROKEN_TCP_NOPUSH
	setopt(fd, TCP_NOPUSH, 1, err0);
#endif
#endif
#endif

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}
开发者ID:Tarsnap,项目名称:tarsnap,代码行数:30,代码来源:tsnetwork_cork.c


示例4: loglikdistrib

void loglikdistrib(Int_t ntrials = 10000, Bool_t print = kFALSE)
{
  // compute distribution of log likelihood value
  TH1D * hmc   = gStack[gPadNr][gOrder[gPadNr][0]];
  TH1D * hdata = gStack[gPadNr][gMaxProcess-1];
  Int_t nbins = hmc->GetNbinsX();
  Double_t loglik = loglikelihood(hmc, hdata, 1, nbins);
  TH1D * htest = new TH1D(*hdata);
  TH1D * lldistrib = new TH1D("lldistrib", "log(Likelihood) distribution", 
			      1000, loglik-200, loglik+200);
  setopt(lldistrib);
  for (Int_t n = 0; n < ntrials; n++) {
    // generate poisson around theorie
    for (Int_t i = 1; i <= nbins; i++) {
      htest->SetBinContent(i, gRandom->Poisson(hmc->GetBinContent(i)));
    }
    lldistrib->Fill(loglikelihood(hmc, htest, 1, nbins));
  }
  TCanvas * llcanvas = new TCanvas("llcanvas", "Log(Likelihood) distribution", 
				   40, 40, 800, 600);
  setopt(llcanvas);
  lldistrib->SetFillColor(kYellow);
  lldistrib->Draw();
  lldistrib->GetYaxis()->SetTitle("Anzahl Ereignisse");
  lldistrib->GetXaxis()->SetTitle("-ln L");
  // autozoom
  Int_t lowbin = 1;
  while (lldistrib->GetBinContent(lowbin) == 0)
    lowbin++;
  Int_t highbin = lldistrib->GetNbinsX();
  while (lldistrib->GetBinContent(highbin) == 0)
    highbin--;
  lldistrib->SetAxisRange(lldistrib->GetBinLowEdge(lowbin), 
			  lldistrib->GetBinLowEdge(highbin));
  TH1D * hworse = (TH1D *) lldistrib->Clone();
  for (Int_t nbin = 1; nbin < 501; nbin++) {
    hworse->SetBinContent(nbin, 0);
  }
  hworse->SetFillColor(95);
  hworse->Draw("same");
  Double_t pvalue = lldistrib->Integral(501,1000) / lldistrib->Integral();
  TLatex * tex = new TLatex(0.18, 0.96, Form("-ln L_{obs} = %5.2f", loglik));
  tex->SetNDC();
  tex->SetTextAlign(13);
  tex->Draw();
  tex = new TLatex(0.18, 0.86, Form("CL_{obs} = %.3f", pvalue));
  tex->SetNDC();
  tex->SetTextAlign(13);
  tex->Draw();
  TLine * l = new TLine(loglik, 0, loglik, lldistrib->GetMaximum());
  l->SetLineWidth(3);
  l->SetLineColor(kBlue);
  l->Draw();
  llcanvas->Modified();
  llcanvas->Update();
  if (print)
    llcanvas->Print("lldistrib.pdf");
  cd(gPadNr+1);
}
开发者ID:radziej,项目名称:findsusyb3,代码行数:59,代码来源:stat.C


示例5: calculate_b_efficiency

void calculate_b_efficiency()
{
  TH2D * h2_btag_num_b = 0;
  plot2("btag_num_b");
  for (int i = 0; i < gMaxProcess; i++) {
    if (strstr(gProcess[i].fname, "ttjets") != 0) {
      h2_btag_num_b = new TH2D(*gHisto2[i]);
    }
  }
  TH2D * h2_btag_denom_b = 0;
  plot2("btag_denom_b");
  for (int i = 0; i < gMaxProcess; i++) {
    if (strstr(gProcess[i].fname, "ttjets") != 0) {
      h2_btag_denom_b = new TH2D(*gHisto2[i]);
    }
  }

  TH2D * h2_b_eff = new TH2D(*h2_btag_num_b);
  h2_b_eff->Divide(h2_btag_num_b, h2_btag_denom_b, 1., 1., "B");
  new TCanvas;
  //h2_b_eff->GetXaxis()->SetRangeUser(5,800);
  //h2_b_eff->GetYaxis()->SetRangeUser(-2.4,2.4);
  h2_b_eff->Draw();

  TFile * f = new TFile("btag_eff_map.root", "UPDATE");
  h2_b_eff->Smooth();
  h2_b_eff->Write();
  f->Close();
  INFO("Written efficiency map for b-quarks to btag_eff_map.root");

  
  TH1D * h1_btag_num_b = h2_btag_num_b->ProjectionX();
  TH1D * h1_btag_denom_b = h2_btag_denom_b->ProjectionX();

  TH1D * h1_b_eff = new TH1D(*h1_btag_num_b);
  h1_b_eff->Divide(h1_btag_num_b, h1_btag_denom_b, 1., 1., "B");
  
  TCanvas * b_proj = new TCanvas("b_proj", "b_proj", 800,600);
  b_proj->cd();
  setopt(b_proj);
  setopt(h1_b_eff);
  h1_b_eff->SetMarkerStyle(8);
  h1_b_eff->SetMarkerSize(.7);
  h1_b_eff->SetTitle("");
  h1_b_eff->GetYaxis()->SetTitle("b-tagging efficiency");
  h1_b_eff->GetXaxis()->SetTitle("transverse momentum of jets [GeV]");
  h1_b_eff->GetXaxis()->CenterTitle();
  h1_b_eff->GetYaxis()->SetTitleFont(62);
  h1_b_eff->GetYaxis()->SetTitleSize(0.04);
  h1_b_eff->GetYaxis()->SetLabelFont(62);
  h1_b_eff->GetYaxis()->SetLabelSize(0.04);
  h1_b_eff->GetXaxis()->SetTitleFont(62);
  h1_b_eff->GetXaxis()->SetTitleSize(0.04);
  h1_b_eff->GetXaxis()->SetLabelFont(62);
  h1_b_eff->GetXaxis()->SetLabelSize(0.04);
  h1_b_eff->Draw();
  lumi();
  drawperiod();
}
开发者ID:radziej,项目名称:findsusyb3,代码行数:59,代码来源:btag.C


示例6: main

int main(int argc, char* argv[]) {
    std::vector<std::string> args(argv, argv+argc);

    std::string url;
    size_t iterations = 1000;
    try {
        url = args.at(1);
        if (args.size() > 2)
            iterations = atoi(args.at(2).c_str());
    } catch (std::exception& e) {
        std::cerr << "exception: " << e.what() << std::endl;
        std::cerr << "usage: " << args.at(0) << " url iterations" << std::endl;
        return 1;
    }

    curl_init();

    CURL* curl = curl_easy_init();
    if (!curl) {
        logError("curl_easy_init");
        return 1;
    }

    setopt(curl, CURLOPT_URL, url.c_str());
    setopt(curl, CURLOPT_TIMEOUT, 5L);
    setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L);
    setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
    setopt(curl, CURLOPT_HEADER, 1L);
    setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

    char send_data[] = "words, words, words";

    for (size_t i = 0; i < iterations; i++) {
        ReadState read_state(send_data, strlen(send_data));
        setopt(curl, CURLOPT_POST, 1L);
        setopt(curl, CURLOPT_READFUNCTION, read_callback);
        setopt(curl, CURLOPT_READDATA, &read_state);
        setopt(curl, CURLOPT_POSTFIELDSIZE, read_state.remains);

        bool sent = false;
        for (size_t i = 0; i < 3; i++) {
            if (perform(curl)) {
                std::cout << "^";
                sent = true;
                break;
            }
            std::cout << ".";
        }
        if (!sent) {
            std::cout << "!";
        }
    }

    curl_easy_cleanup(curl);
    curl_cleanup();

    return 0;
}
开发者ID:hfutxrl2011,项目名称:curl_race,代码行数:58,代码来源:main_curl_race.cpp


示例7: main

int
main(int argc, char **argv)
{

	space(0,0,4096,4096);
	init(&xd);
	init(&yd);
	xd.xsize = yd.xsize = 1.;
	xx = (struct val *)malloc((unsigned)sizeof(struct val));
	labsarr = malloc(1);
	labsarr[labsiz++] = 0;
	setopt(argc,argv);
	if(erasf)
		erase();
	readin();
	transpose();
	scale(&xd,(struct val *)&xx->xv);
	scale(&yd,(struct val *)&xx->yv);
	axes();
	title();
	plot();
	move(1,1);
	closevt();
	return(0);
}
开发者ID:andreiw,项目名称:polaris,代码行数:25,代码来源:graph.c


示例8: main

int main(int argc, char **argv)
{
	// save lines inputed in a pointer array 
	int lines, revert, fold, directory;
	fold = directory = 0;
	revert = 1;

	// Use dynamic allocation memory: Umm... maybe in the next time.
	char alloc[ALLOCSIZE];
	char *ptarr[MAXLINES];
	// Check argument
	while (--argc > 0 && (*++argv)[0] == '-')
	{
		char *p;
		p = argv[0];
		if (!setopt(p,&directory, &revert, &fold))	
		{
			youneedhelp();
			return EXIT_FAILURE;
		}
	}

	while ((lines = readlines(ptarr, MAXLINES, alloc)) > 0)
	{
		// any pointer can be cast to void * and back again without loss of information.
		int (*comp)(void *, void *, int);
		// Is it too long :(
		comp = (int (*)(void *, void *, int))(directory ? strdfcmp : strfcmp); 
		// sorting use quick sort algorithm.
		myqsort((void**)ptarr, 0, lines-1, comp, fold, revert);
		writelines(ptarr,lines);
	}
	return EXIT_SUCCESS;
}
开发者ID:ducanhng,项目名称:ctuto,代码行数:34,代码来源:ex5_14v2.c


示例9: new_socket

int			new_socket(int port)
{
  int			cs;
  int			fd;
  struct protoent	*pe;
  struct sockaddr_in	sin;
  
  pe = getprotobyname("TCP");
  if ((fd = socket(AF_INET, SOCK_STREAM, pe->p_proto)) == -1)
    return (-1);
  sin.sin_family = AF_INET;
  sin.sin_port = htons(port);
  sin.sin_addr.s_addr = INADDR_ANY;
  setopt(fd);
  if (bind(fd, (const struct sockaddr*)&sin, sizeof(sin)) == -1)
    {
      close(fd);
      return (-1);
    }
  if ((cs = listen(fd, 1)) == -1)
    {
      close(fd);
      return (-1);
    }
  g_dfd = fd;
  return (0);
}
开发者ID:amstuta,项目名称:MyFtp,代码行数:27,代码来源:data_connection.c


示例10: getopt

int sockbuf::recvbufsz (int sz) const
{
    int old=0;
    getopt (so_rcvbuf, &old, sizeof (old));
    setopt (so_rcvbuf, &sz, sizeof (sz));
    return old;
}
开发者ID:drescherjm,项目名称:GDCM,代码行数:7,代码来源:sockstream.cpp


示例11: check_curl_code

U32 LLCurl::Easy::report(CURLcode code)
{
	U32 responseCode = 0;	
	std::string responseReason;
	
	if (code == CURLE_OK)
	{
		check_curl_code(curl_easy_getinfo(mCurlEasyHandle, CURLINFO_RESPONSE_CODE, &responseCode));
		//*TODO: get reason from first line of mHeaderOutput
	}
	else
	{
		responseCode = 499;
		responseReason = strerror(code) + " : " + mErrorBuffer;
		setopt(CURLOPT_FRESH_CONNECT, TRUE);
	}

	if (mResponder)
	{	
		mResponder->completedRaw(responseCode, responseReason, mChannels, mOutput);
		mResponder = NULL;
	}
	
	resetState();
	return responseCode;
}
开发者ID:HizWylder,项目名称:GIS,代码行数:26,代码来源:llcurl.cpp


示例12: old

sockbuf::socklinger sockbuf::linger (sockbuf::socklinger opt) const
{
    socklinger old (0, 0);
    getopt (so_linger, &old, sizeof (old));
    setopt (so_linger, &opt, sizeof (opt));
    return old;
}
开发者ID:drescherjm,项目名称:GDCM,代码行数:7,代码来源:sockstream.cpp


示例13: setopt

bool JPWiFly::setDHCP(const uint8_t mode) {
	char buf[2];
	if (mode > 9)
		return false;
	buf[0] = '0' + mode;
	buf[1] = 0;
	return setopt(PSTR("set ip dhcp"), buf);
}
开发者ID:jasminlapalme,项目名称:JPWiFly,代码行数:8,代码来源:JPWiFly.cpp


示例14: check_error

bool sinsp_curl::get_data(std::ostream& os)
{
	CURLcode res = CURLE_OK;
	check_error(curl_easy_setopt(m_curl, CURLOPT_URL, m_uri.to_string().c_str()));
	check_error(curl_easy_setopt(m_curl, CURLOPT_HEADERDATA, m_redirect));
	check_error(curl_easy_setopt(m_curl, CURLOPT_HEADERFUNCTION, header_callback));
	check_error(curl_easy_setopt(m_curl, CURLOPT_CONNECTTIMEOUT, static_cast<int>(m_timeout_ms / 1000)));
	check_error(curl_easy_setopt(m_curl, CURLOPT_TIMEOUT_MS, m_timeout_ms));
	check_error(curl_easy_setopt(m_curl, CURLOPT_NOSIGNAL, 1)); //Prevent "longjmp causes uninitialized stack frame" bug
	check_error(curl_easy_setopt(m_curl, CURLOPT_ACCEPT_ENCODING, "deflate"));
	check_error(curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, &sinsp_curl::write_data));
	check_error(curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, &os));
	check_error(curl_easy_setopt(m_curl, CURLOPT_READFUNCTION, &read_data));
	check_error(curl_easy_setopt(m_curl, CURLOPT_READDATA, &m_body));
	if(m_headers.ptr() != NULL)
	{
		setopt(CURLOPT_HTTPHEADER, m_headers.ptr());
	}
	res = curl_easy_perform(m_curl);
	if(res != CURLE_OK)
	{
		os << curl_easy_strerror(res) << std::flush;
	}
	else
	{
		// HTTP errors are not returned by curl API
		// error will be in the response stream
		check_error(curl_easy_getinfo(m_curl, CURLINFO_RESPONSE_CODE, &m_response_code));
		if(m_response_code >= 400)
		{
			g_logger.log("CURL HTTP error while accessing [" + m_uri.to_string(false) + "]: " +
						 std::to_string(m_response_code) + " (" + http_reason::get(m_response_code) + ')', sinsp_logger::SEV_ERROR);
			return false;
		}
		else if(is_redirect(m_response_code))
		{
			g_logger.log("HTTP redirect (" + std::to_string(m_response_code) + ')', sinsp_logger::SEV_DEBUG);
			if(handle_redirect(m_uri, std::string(m_redirect), os))
			{
				std::ostringstream* pos = dynamic_cast<std::ostringstream*>(&os);
				if(pos)
				{
					pos->str("");
					return get_data(*pos);
				}
				else
				{
					g_logger.log("HTTP redirect received from [" + m_uri.to_string(false) + "] but "
							 "output stream can not be obtained (dynamic cast failed).",
							 sinsp_logger::SEV_ERROR);
					return false;
				}
			}
		}
	}

	return res == CURLE_OK;
}
开发者ID:draios,项目名称:sysdig,代码行数:58,代码来源:sinsp_curl.cpp


示例15: resetState

void LLCurl::Easy::prepRequest(const std::string& url,
                               const std::vector<std::string>& headers,
                               ResponderPtr responder, bool post)
{
    resetState();

    if (post) setoptString(CURLOPT_ENCODING, "");

//	setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
    setopt(CURLOPT_NOSIGNAL, 1);

    mOutput.reset(new LLBufferArray);
    setopt(CURLOPT_WRITEFUNCTION, (void*)&curlWriteCallback);
    setopt(CURLOPT_WRITEDATA, (void*)this);

    setopt(CURLOPT_READFUNCTION, (void*)&curlReadCallback);
    setopt(CURLOPT_READDATA, (void*)this);

    setopt(CURLOPT_HEADERFUNCTION, (void*)&curlHeaderCallback);
    setopt(CURLOPT_HEADERDATA, (void*)this);

    setErrorBuffer();
    setCA();

    setopt(CURLOPT_SSL_VERIFYPEER, LLCurl::getSSLVerify());
    setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify()? 2 : 0);
    setopt(CURLOPT_TIMEOUT, CURL_REQUEST_TIMEOUT);

    setoptString(CURLOPT_URL, url);

    mResponder = responder;

    if (!post)
    {
        slist_append("Connection: keep-alive");
        slist_append("Keep-alive: 300");
        // Accept and other headers
        for (std::vector<std::string>::const_iterator iter = headers.begin();
                iter != headers.end(); ++iter)
        {
            slist_append((*iter).c_str());
        }
    }
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:44,代码来源:llcurl.cpp


示例16: main

int
main(int argc, char **argv)
{
	FILE *fi;
	char sobuf[BUFSIZ];
	char *cp;
	int nofile;
	char *locale;

	outp = NOSTR;
	setbuf(stdout, sobuf);
	setlocale(LC_ALL, "");
	locale = setlocale(LC_CTYPE, "");
	if (strcmp(locale, "C") == 0) {
		split = csplit;
	} else {
		split = msplit;
		_wckind_init();
	}
	if (argc < 2) {
single:
		fmt(stdin);
		oflush();
		exit(0);
	}
	nofile = 1;
	while (--argc) {
		cp = *++argv;
		if (setopt(cp))
			continue;
		nofile = 0;
		if ((fi = fopen(cp, "r")) == NULL) {
			perror(cp);
			errs++;
			continue;
		}
		fmt(fi);
		fclose(fi);
	}
	if (nofile)
		goto single;
	oflush();
	fclose(stdout);
	return (errs);
}
开发者ID:alhazred,项目名称:onarm,代码行数:45,代码来源:fmt.c


示例17: resetState

void LLCurl::Easy::prepRequest(const std::string& url, ResponderPtr responder, bool post)
{
	resetState();
	
	if (post) setoptString(CURLOPT_ENCODING, "");

//	setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
	setopt(CURLOPT_NOSIGNAL, 1);

	mOutput.reset(new LLBufferArray);
	setopt(CURLOPT_WRITEFUNCTION, (void*)&curlWriteCallback);
	setopt(CURLOPT_WRITEDATA, (void*)this);

	setopt(CURLOPT_READFUNCTION, (void*)&curlReadCallback);
	setopt(CURLOPT_READDATA, (void*)this);
	
	setopt(CURLOPT_HEADERFUNCTION, (void*)&curlHeaderCallback);
	setopt(CURLOPT_HEADERDATA, (void*)this);

	setErrorBuffer();
	setCA();

	setopt(CURLOPT_SSL_VERIFYPEER, true);
	setopt(CURLOPT_TIMEOUT, CURL_REQUEST_TIMEOUT);

	setoptString(CURLOPT_URL, url);

	mResponder = responder;

	if (!post)
	{
		slist_append("Connection: keep-alive");
		slist_append("Keep-alive: 300");
	}
	// *FIX: should have ACCEPT headers
}
开发者ID:Boy,项目名称:rainbow,代码行数:36,代码来源:llcurl.cpp


示例18: make_socket

int make_socket(const int fe_port) {
  const int socketfd = socket(AF_INET, SOCK_STREAM, 0);
  if (socketfd < 0) {
    error("ERROR opening socket");
  } else {
    // printf("new socket %d\n", socketfd);
    setopt(socketfd);
  }

  struct sockaddr_in servaddr;
  bzero(&servaddr, sizeof(servaddr));
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servaddr.sin_port = htons(fe_port);
  servaddr.sin_family = AF_INET;
  if (bind(socketfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
    error("ERROR on binding");

  return socketfd;
}
开发者ID:companycy,项目名称:sql-protocol,代码行数:19,代码来源:proxyserver.c


示例19: setopt

    std::pair<http::Status, std::string> HttpClient::del(const std::string& path, const std::string& query)
    {
        std::pair<http::Status, std::string> r;
        r.second.reserve(Buffer_Size);

        setopt(CURLOPT_HEADERFUNCTION, &headerStatusCallback);
        setopt(CURLOPT_URL, makeUrl(path, query).c_str());
        setopt(CURLOPT_WRITEDATA, &r.second);
        setopt(CURLOPT_HEADERDATA, &r.first);
        setopt(CURLOPT_HTTPGET, 1l);
        setopt(CURLOPT_CUSTOMREQUEST, "DELETE");
        perform();

        return r;
    }
开发者ID:oliora,项目名称:ppconsul,代码行数:15,代码来源:http_client.cpp


示例20: get_sendfd

int get_sendfd(const char* sqlserver_ip, const int sqlserver_port) {
  const int sendfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sendfd < 0) {
    error("ERROR opening socket");
  } else if (!sqlserver_ip || *sqlserver_ip == '\0') {
    error("ERROR on sql server ip");
  } else {
    // printf("new socket on %d, %s %d\n", sendfd, sqlserver_ip, sqlserver_port);
    setopt(sendfd);
  }

  struct sockaddr_in sendaddr;
  bzero(&sendaddr, sizeof(sendaddr));
  sendaddr.sin_family = AF_INET;
  sendaddr.sin_addr.s_addr = inet_addr(sqlserver_ip);
  // sendaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  sendaddr.sin_port = htons(sqlserver_port);
  if (connect(sendfd, (struct sockaddr *) &sendaddr,sizeof(sendaddr)) < 0) 
    error("ERROR connecting");
  else
    printf("connected to backend sql server from port: %d\n", sqlserver_port);

  return sendfd;
}
开发者ID:companycy,项目名称:sql-protocol,代码行数:24,代码来源:proxyserver.c



注:本文中的setopt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setp函数代码示例发布时间:2022-05-30
下一篇:
C++ setobj2t函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap