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

C++ er函数代码示例

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

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



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

示例1: receive_file

void receive_file(struct packet* hp, struct packet* data, int sfd, FILE* f)
{
	int x;
	int i = 0, j = 0;
	if((x = recv(sfd, data, size_packet, 0)) <= 0)
		er("recv()", x);
	j++;
	hp = ntohp(data);
	printpacket(hp, HP);
	// 当在数据传输的时候 type字段会用来标示是否
	while(hp->type == DATA)
	{
		// 将收到的数据写入文件,二进制写入方式
		i += fwrite(hp->buffer, 1, hp->datalen, f);
		if((x = recv(sfd, data, size_packet, 0)) <= 0)
			er("recv()", x);
		j++;
		hp = ntohp(data);
		printpacket(hp, HP);
	}
	fprintf(stderr, "\t%d data packet(s) received.\n", --j);	// j decremented because the last packet is EOT.
	fprintf(stderr, "\t%d byte(s) written.\n", i);
	if(hp->type == EOT)
		return;
	else
	{
		fprintf(stderr, "Error occured while downloading remote file.\n");
		exit(2);
	}
	fflush(stderr);
}
开发者ID:vonzhou,项目名称:simple-ftp,代码行数:31,代码来源:file_transfer_functions.c


示例2: command_rput

void command_rput(int sfd_client, struct packet* chp)
{
	static char lpwd[LENBUFFER];
	if(!getcwd(lpwd, sizeof lpwd))
		er("getcwd()", 0);
	DIR* d = opendir(lpwd);
	if(!d)
		er("opendir()", (int) d);
	struct dirent* e;
	struct command* cmd = (struct command*) malloc(sizeof(struct command));
	cmd->id = RPUT;
	cmd->npaths = 0;
	cmd->paths = NULL;
	while((e = readdir(d)) != NULL)
		if(e->d_type == 8)
			append_path(cmd, e->d_name);
		else if(e->d_type == 4 && strcmp(e->d_name, ".") && strcmp(e->d_name, ".."))
		{
			command_mkdir(sfd_client, chp, e->d_name);
			
			command_cd(sfd_client, chp, e->d_name);
			command_lcd(e->d_name);
			
			command_rput(sfd_client, chp);
			
			command_cd(sfd_client, chp, "..");
			command_lcd("..");
		}
	closedir(d);
	command_mput(sfd_client, chp, cmd->npaths, cmd->paths);
}
开发者ID:keepmov,项目名称:FTP,代码行数:31,代码来源:client_ftp_functions.c


示例3: command_dir

// the opration of DIR command
void command_dir(struct packet* shp, struct packet* data, int sfd_client, char* lpwd)
{
    int x;
    shp->type = DATA;
    DIR* d = opendir(lpwd);
    if(!d)
    {
        er("opendir()", (int) d);
        sprintf(shp->buffer, "ER: could not get the dir info!\n");
        data = htonp(shp);
        if( (x = send(sfd_server_data, data, size_packet,0)) != size_packet)
            er("send()",x);
    }
    else
    {
        sprintf(shp->buffer, "OK: get the dir info.\n");
        data = htonp(shp);
        if(( x = send(sfd_server_data, data, size_packet, 0)) != size_packet)
            er("send()",x);
    }
    struct dirent* e;

    while(e = readdir(d))
    {
        sprintf(shp->buffer, "%s\t%s", e->d_type == 4 ? "DIR:" : e->d_type == 8 ? "FILE:" : "UNDEF:" , e->d_name);
        data = htonp(shp);
        //if(( x = send(sfd_client, data, size_packet, 0)) != size_packet)
        if(( x = send(sfd_server_data, data, size_packet, 0)) != size_packet)    
            er("send()", x);
    }
    send_EOT(shp, data, sfd_server_data);
    //send_EOT(shp, data, sfd_client);
}
开发者ID:DarranStark,项目名称:SimpleFTP,代码行数:34,代码来源:server_ftp_functions.c


示例4: data

void DifBufferBase::zombify( Element* orig, const Cinfo* zClass, 
			     Id hsolve )
{
  if ( orig->cinfo() == zClass )
    return;
  unsigned int start = orig->localDataStart();
  unsigned int num = orig->numLocalData();
  if ( num == 0 )
    return;
  unsigned int len = 14;
  vector< double > data( num * len );

  unsigned int j = 0;
	
  for ( unsigned int i = 0; i < num; ++i ) {
    Eref er( orig, i + start );
    const DifBufferBase* ds = 
      reinterpret_cast< const DifBufferBase* >( er.data() );
    data[j + 0] = ds->getActivation( er );
    data[j + 1] = ds->getBFree( er );
    data[j + 2] = ds->getBBound( er );
    data[j + 3] = ds->getBTot( er );
    data[j + 4] = ds->getKf( er );
    data[j + 5] = ds->getKb( er );
    data[j + 6] = ds->getD( er );
    data[j + 7] = ds->getShapeMode( er );
    data[j + 8] = ds->getLength( er );
    data[j + 9] = ds->getDiameter( er );
    data[j + 10] = ds->getThickness( er );
    data[j + 11] = ds->getVolume( er );
    data[j + 12] = ds->getOuterArea( er );
    data[j + 13] = ds->getInnerArea( er );
    j += len;
  }
  orig->zombieSwap( zClass );
  j = 0;
  for ( unsigned int i = 0; i < num; ++i ) {
    Eref er( orig, i + start );
    DifBufferBase* ds = 
      reinterpret_cast< DifBufferBase* >( er.data() );
    ds->vSetSolver(er,hsolve);
    ds->setActivation(er, data[j+0]);
    ds->setBFree(er, data[j + 1]);
    ds->setBBound(er, data[j + 2]);
    ds->setBTot(er, data[j + 3]);
    ds->setKf(er, data[j + 4]);
    ds->setKb(er, data[j + 5]);
    ds->setD(er, data[j + 6]);
    ds->setShapeMode(er, data[j + 7]);
    ds->setLength(er, data[j + 8]);
    ds->setDiameter(er, data[j + 9]);
    ds->setThickness(er, data[j + 10]);
    ds->setVolume(er, data[j + 11]);
    ds->setOuterArea(er, data[j + 12]);
    ds->setInnerArea(er, data[j + 13]);
    j += len; //??
  }
	
}
开发者ID:asiaszmek,项目名称:moose,代码行数:59,代码来源:DifBufferBase.cpp


示例5: main

/*
 * A tadpole with a full propagator and with 1 LV vertex
 */
main()
{
  page                   pg;
  FeynDiagram            fd(pg);

#define RAD    2.5

  fd.line_thickness.set(0.15);
  fd.vertex_thickness.set(0.15);
  /* define the left and the right external points */
  xy                     el(-TADPOLELEG, 0), er(6, 0);
  /* the LV vertex */
  xy                     arcpt1(RAD, 0);
  xy                     arcpt2(0, -RAD);
  /* the ordinary SQED vertex */
  vertex_circlecross     v1(fd, -RAD, 0);
  vertex                 v2(fd,  RAD, 0);
  vertex                 fict(fd, -RAD - 0.5, 0);   /* for a nicer picture */
  /* photon line propagators */
  line_wiggle            ph1(fd, el, fict);

  line_plain             f1(fd, v1, v1);
  f1.thickness.set(FULLPROPTHICK);
  f1.arrowon.setfalse();
  //  line_plain             f2(fd, v2, v1);

  /* stretch it to be an arc */

  f1.arcthru(arcpt1);
  //  f2.arcthru(arcpt2);

  pg.output();
  return 0;
}
开发者ID:pasha-bolokhov,项目名称:sqed,代码行数:37,代码来源:fulltadpole1.C


示例6: assert

vector< ObjId > Element::getMsgTargets( DataId srcDataId,
				const SrcFinfo* finfo  ) const
{
	assert( finfo ); // would like to check that finfo is on this.
	assert( srcDataId < this->numData() );

	vector< ObjId > ret;
	Eref er( const_cast< Element* >( this ), srcDataId );

	const vector< MsgDigest >&md = er.msgDigest( finfo->getBindIndex() );
	for ( vector< MsgDigest >::const_iterator
		i = md.begin(); i != md.end(); ++i ) {
		for ( vector< Eref >::const_iterator
			j = i->targets.begin(); j != i->targets.end(); ++j ) {
				if ( j->dataIndex() == ALLDATA ) {
					for ( unsigned int k = 0; 
									k < j->element()->numData(); ++k )
						ret.push_back( ObjId( j->id(), k ) );
				} else {
					ret.push_back( j->objId() );
				}
		}
	}
	return ret;
}
开发者ID:NeuroArchive,项目名称:moose,代码行数:25,代码来源:Element.cpp


示例7: er

bd_result banco::executaQuery(const string& q)
{
	MYSQL_ROW linha;
	MYSQL_FIELD* colunas;
	unsigned int i;
	string col;
	bd_result R;
	map <string, string> RES;
	
	if(mysql_query(sock,q.c_str())) {
		ostringstream er("");
		er << mysql_error(sock);
		throw queryErro(er.str().c_str(), q,  mysql_errno(sock));
	} else {
//		cout << "Query executada!" << endl;
		result = mysql_store_result(sock);
		if (result)
		{
			colunas = mysql_fetch_fields(result);
			while ((linha=mysql_fetch_row(result)) != NULL)
			{
				for (i=0; i<mysql_num_fields(result); i++) {
					col = colunas[i].name;
					RES[col] = linha[i];
				}
				R.push_back(RES);
			}
		}
	}
	mysql_free_result(result);
	return R;
}
开发者ID:mnribeiro,项目名称:Desambiguator,代码行数:32,代码来源:banco.cpp


示例8: isSymmetric

  /*! This method employs the static method matrix3x3::jacobi(...)
    to find the eigenvalues and eigenvectors of a symmetric
    matrix. On entry it is checked if the matrix really is
    symmetric: if isSymmetric() returns 'false', an OBError is
    thrown.
 
    \note The jacobi algorithm is should work great for all
    symmetric 3x3 matrices. If you need to find the eigenvectors
    of a non-symmetric matrix, you might want to resort to the
    sophisticated routines of LAPACK.
 
    @param eigenvals a reference to a vector3 where the
    eigenvalues will be stored. The eigenvalues are ordered so
    that eigenvals[0] <= eigenvals[1] <= eigenvals[2].
 
    @return an orthogonal matrix whose ith column is an
    eigenvector for the eigenvalue eigenvals[i]. Here 'orthogonal'
    means that all eigenvectors have length one and are mutually
    orthogonal. The ith eigenvector can thus be conveniently
    accessed by the GetColumn() method, as in the following
    example.
    \code
    // Calculate eigenvectors and -values
    vector3 eigenvals;
    matrix3x3 eigenmatrix = somematrix.findEigenvectorsIfSymmetric(eigenvals);
  
    // Print the 2nd eigenvector
    cout << eigenmatrix.GetColumn(1) << endl;
    \endcode
    With these conventions, a matrix is diagonalized in the following way:
    \code
    // Diagonalize the matrix
    matrix3x3 diagonalMatrix = eigenmatrix.inverse() * somematrix * eigenmatrix;
    \endcode
  
  */
  matrix3x3 matrix3x3::findEigenvectorsIfSymmetric(vector3 &eigenvals) const
#ifdef OB_OLD_MATH_CHECKS
  throw(OBError)
#endif
  {
    matrix3x3 result;

#ifdef OB_OLD_MATH_CHECKS
    if (!isSymmetric())
      {
        OBError er("matrix3x3::findEigenvectorsIfSymmetric(vector3 &eigenvals) const throw(OBError)",
                   "The method was called on a matrix that was not symmetric, i.e. where isSymetric() == false.",
                   "This is a runtime or a programming error in your application.");
        throw er;
      }
#endif

    double d[3];
    matrix3x3 copyOfThis = *this;

    jacobi(3, copyOfThis.ele[0], d, result.ele[0]);
    eigenvals.Set(d);

    return result;
  }
开发者ID:annulen,项目名称:openbabel,代码行数:61,代码来源:matrix3x3.cpp


示例9: main

int main(int argc, char** argv)
{
    // Get user parameters.
    Opm::parameter::ParameterGroup param(argc, argv, false);

    // Create the Equelle runtime.
    EquelleRuntimeCPU er(param);

    ensureRequirements(er);

    // ============= Generated code starts here ================

    const CollOfScalar a = er.operatorExtend(double(1), er.allCells());
    const CollOfScalar b = er.operatorExtend(double(2), er.interiorCells());
    const CollOfScalar c = er.operatorExtend(double(3), er.boundaryCells());
    const CollOfScalar d = ((a + er.operatorExtend(b, er.interiorCells(), er.allCells())) + er.operatorExtend(c, er.boundaryCells(), er.allCells()));
    er.output("a", a);
    er.output("b", b);
    er.output("c", c);
    er.output("d", d);

    // ============= Generated code ends here ================

    return 0;
}
开发者ID:jakhog,项目名称:equelle,代码行数:25,代码来源:gridTestCPU.cpp


示例10: throw

  /*! This method checks if the absolute value of the determinant is smaller than 1e-6. If
    so, nothing is done and an exception is thrown. Otherwise, the
    inverse matrix is calculated and returned. *this is not changed.
	
    \warning If the determinant is close to zero, but not == 0.0,
    this method may behave in unexpected ways and return almost
    random results; details may depend on your particular floating
    point implementation. The use of this method is therefore highly
    discouraged, unless you are certain that the determinant is in a
    reasonable range, away from 0.0 (Stefan Kebekus)
  */
  matrix3x3 matrix3x3::inverse(void) const
#ifdef OB_OLD_MATH_CHECKS
  throw(OBError)
#endif
  {
    double det = determinant();

#ifdef OB_OLD_MATH_CHECKS
    if (fabs(det) <= 1e-6)
      {
        OBError er("matrix3x3::invert(void)",
                   "The method was called on a matrix with |determinant| <= 1e-6.",
                   "This is a runtime or a programming error in your application.");
        throw er;
      }
#endif

    matrix3x3 returnValue;
    returnValue.ele[0][0] = ele[1][1]*ele[2][2] - ele[1][2]*ele[2][1];
    returnValue.ele[1][0] = ele[1][2]*ele[2][0] - ele[1][0]*ele[2][2];
    returnValue.ele[2][0] = ele[1][0]*ele[2][1] - ele[1][1]*ele[2][0];
    returnValue.ele[0][1] = ele[2][1]*ele[0][2] - ele[2][2]*ele[0][1];
    returnValue.ele[1][1] = ele[2][2]*ele[0][0] - ele[2][0]*ele[0][2];
    returnValue.ele[2][1] = ele[2][0]*ele[0][1] - ele[2][1]*ele[0][0];
    returnValue.ele[0][2] = ele[0][1]*ele[1][2] - ele[0][2]*ele[1][1];
    returnValue.ele[1][2] = ele[0][2]*ele[1][0] - ele[0][0]*ele[1][2];
    returnValue.ele[2][2] = ele[0][0]*ele[1][1] - ele[0][1]*ele[1][0];

    returnValue /= det;

    return(returnValue);
  }
开发者ID:annulen,项目名称:openbabel,代码行数:43,代码来源:matrix3x3.cpp


示例11: main

/*
 * Diagram "F", SQED, unbroken SUSY,
 * Gauge sector.
 */
main()
{
  page                   pg;
  FeynDiagram            fd(pg);

#define RAD    2.5

  fd.line_thickness.set(0.15);
  fd.vertex_thickness.set(0.15);
  /* define the left and the right external points */
  xy                     el(-6, 0), er(6, 0);

  xy              arcpt1(RAD, 0);    arcpt1.rotate(90); arcpt1 += xy(0,RAD);

  arcpt1 += xy(0, GAUGE_LIFT1);

  /* the LV vertex */
  xy                     lv_coord(0, GAUGE_LIFT1);
  vertex_circlecross     v1(fd, lv_coord);        

  /* photon line propagators */
  line_wiggle            ph1(fd, el, er); ph1.width.scale(0.7);

  line_plain             f1(fd, v1, v1);

  /* stretch it to be an arc */

  f1.arcthru(arcpt1);

  pg.output();
  return 0;
}
开发者ID:pasha-bolokhov,项目名称:sqed,代码行数:36,代码来源:diag_gauge_F.C


示例12: tst_expr_arith

void tst_expr_arith(unsigned num_files) {
    ast_manager m;
    reg_decl_plugins(m);

    expr_rand er(m);    
    er.seed(rand_seed);
    er.initialize_arith(20);

    family_id fid = m.mk_family_id("arith");
    sort* int_ty  = m.mk_sort(fid, INT_SORT, 0, 0);
    sort* real_ty = m.mk_sort(fid, REAL_SORT, 0, 0);

    er.initialize_array(3, int_ty, int_ty);
    er.initialize_array(3, int_ty, real_ty);

    er.initialize_basic(20);

    for (unsigned i = 0; i < num_files; ++i) {
        expr_ref e(m);
        er.get_next(m.mk_bool_sort(), e);
        ast_smt_pp pp(m);

        pp.set_logic(symbol("QF_AUFLIA"));
        std::ostringstream buffer;
        buffer << "random_arith_" << i << ".smt";
        std::cout << buffer.str() << "\n";
        std::ofstream file(buffer.str().c_str());
        pp.display(file, e.get());
        file.close();
    }
    
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:32,代码来源:expr_rand.cpp


示例13: send_EOT

void send_EOT(struct packet* hp, struct packet* data, int sfd)
{
	int x;
	hp->type = EOT;
	data = htonp(hp);
	if((x = send(sfd, data, size_packet, 0)) != size_packet)
		er("send()", x);
}
开发者ID:107nationalstation,项目名称:FTP,代码行数:8,代码来源:file_transfer_functions.c


示例14: data

// static func
void CaConcBase::zombify( Element* orig, const Cinfo* zClass, 
			  Id hsolve )
{
  if ( orig->cinfo() == zClass )
    return;
  unsigned int start = orig->localDataStart();
  unsigned int num = orig->numLocalData();
  if ( num == 0 )
    return;
  vector< double > data( num * 9 );

  unsigned int j = 0;
  for ( unsigned int i = 0; i < num; ++i ) {
    Eref er( orig, i + start );
    const CaConcBase* cb = 
      reinterpret_cast< const CaConcBase* >( er.data() );
    data[j + 0] = cb->getCa( er );
    data[j + 1] = cb->getCaBasal( er );
    data[j + 2] = cb->getTau( er );
    data[j + 3] = cb->getB( er );
    data[j + 4] = cb->getCeiling( er );
    data[j + 5] = cb->getFloor( er );
    data[j + 6] = cb->getThickness( er );
    data[j + 7] = cb->getLength( er );
    data[j + 8] = cb->getDiameter( er );
    j += 9;
  }
  orig->zombieSwap( zClass );
  j = 0;
  for ( unsigned int i = 0; i < num; ++i ) {
    Eref er( orig, i + start );
    CaConcBase* cb = reinterpret_cast< CaConcBase* >( er.data() );
    cb->vSetSolver( er, hsolve );
    cb->setCa( er, data[j + 0] );
    cb->setCaBasal( er, data[j + 1] );
    cb->setTau( er, data[j + 2] );
    cb->setB( er, data[j + 3] );
    cb->setCeiling( er, data[j + 4] );
    cb->setFloor( er, data[j + 5] );
    cb->setThickness( er, data[j + 6] );
    cb->setLength( er, data[j + 7] );
    cb->setDiameter( er, data[j + 8] );
    j += 9; //was 7?
  }
}
开发者ID:asiaszmek,项目名称:moose,代码行数:46,代码来源:CaConcBase.cpp


示例15: cd

//Arthur says he doesn't use malloc or free. Andrei Moutchkine claims smallest unit is vm page (his truss says no malloc + add pages one at a time).
//Arthur not using malloc is probably true. No strdup & related functions in binary's strings. Note: Skelton references "different allocator" not in \w report
//This source would be improved by getting ridding of remaing malloc/calloc/realloc
K cd(K a)
{
  #ifdef DEBUG
  if(a && a->c <=0 ) { er(Tried to cd() already freed item) dd(tests) dd(a) dd(a->c) dd(a->t) dd(a->n) show(a); }
  #endif 
  if(!a || --a->c) R a;
  #ifdef DEBUG
  DO(kreci, if(a==krec[i]){krec[i]=0; break; })
  #endif 
  if(7==a->t){ DO(-2+TYPE_SEVEN_SIZE,cd(kV(a)[2+i]))} //-4 special trick: don't recurse on V members. assumes sizeof S==K==V.  (don't free CONTEXT or DEPTH)
开发者ID:albertcheng,项目名称:kona,代码行数:13,代码来源:km.c


示例16: send_EOT

void send_EOT(struct packet* hp, struct packet* data, int sfd)
{
	int x;
	hp->type = EOT;
    hp->datalen = 0;
    memset(hp->buffer, '\0', sizeof(char) *LENBUFFER);
	data = htonp(hp);
	if((x = send(sfd, data, size_packet, 0)) != size_packet)
		er("send()", x);
}
开发者ID:vonzhou,项目名称:simple-ftp,代码行数:10,代码来源:file_transfer_functions.c


示例17: command_lls

void command_lls(char* lpwd)
{
	DIR* d = opendir(lpwd);
	if(!d)
		er("opendir()", (int) d);
	struct dirent* e;
	while((e = readdir(d)) != NULL)
		printf("\t%s\t%s\n", e->d_type == 4 ? "DIR:" : e->d_type == 8 ? "FILE:" : "UNDEF", e->d_name);
	closedir(d);
}
开发者ID:keepmov,项目名称:FTP,代码行数:10,代码来源:client_ftp_functions.c


示例18: chandata

void HHChannelBase::zombify( Element* orig, const Cinfo* zClass, Id hsolve )
{
	if ( orig->cinfo() == zClass )
		return;
	unsigned int start = orig->localDataStart();
	unsigned int num = orig->numLocalData();
	if ( num == 0 )
		return;
	// Parameters are Gbar, Ek, Xpower, Ypower, Zpower, useConcentration
	// We also want to haul the original gates over, this is done earlier
	// in the HSolve building process. So just six terms.
	vector< double > chandata( num * 6, 0.0 );
	vector< double >::iterator j = chandata.begin();

	for ( unsigned int i = 0; i < num; ++i ) {
		Eref er( orig, i + start );
		const HHChannelBase* hb = 
			reinterpret_cast< const HHChannelBase* >( er.data() );
		*j = hb->vGetGbar( er );
		*(j+1) = hb->vGetEk( er);
		*(j+2) = hb->getXpower( er );
		*(j+3) = hb->getYpower( er );
		*(j+4) = hb->getZpower( er );
		*(j+5) = hb->getUseConcentration( er );
		j+= 6;
	}
	orig->zombieSwap( zClass );
	j = chandata.begin();
	for ( unsigned int i = 0; i < num; ++i ) {
		Eref er( orig, i + start );
		HHChannelBase* hb = reinterpret_cast< HHChannelBase* >( er.data() );
		hb->vSetSolver( er, hsolve );
		hb->vSetGbar( er, *j );
		hb->vSetEk( er, *(j+1) );
		hb->vSetXpower( er, *(j+2) );
		hb->vSetYpower( er, *(j+3) );
		hb->vSetZpower( er, *(j+4) );
		// hb->vSetUseConcentration( er, *(j+5) > 0.5 );
		// Disable this assignment because the Solver already reads the 
		// value, and it triggers an error msg.
		j+= 6;
	}
}
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:43,代码来源:HHChannelBase.cpp


示例19: main

int main(void)
{
//BEGIN: initialization
struct sockaddr_in sin_server, sin_client;
int sfd_server, sfd_client, x;
short int connection_id = 0;

if((x = sfd_server = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
er("socket()", x);

memset((char*) &sin_server, 0, sizeof(struct sockaddr_in));
sin_server.sin_family = AF_INET;
sin_server.sin_port = htons(PORTSERVER);
sin_server.sin_addr.s_addr = htonl(INADDR_ANY);

if((x = bind(sfd_server, (struct sockaddr*) &sin_server, size_sockaddr)) < 0)
er("bind()", x);

if((x = listen(sfd_server, 1)) < 0)
er("listen()", x);

printf(ID "FTP Server started up @ local:%d. Waiting for client(s)...\n\n", PORTSERVER);
//END: initialization


while(1)
{
if((x = sfd_client = accept(sfd_server, (struct sockaddr*) &sin_client, &size_sockaddr)) < 0)
er("accept()", x);
printf(ID "Communication started with %s:%d\n", inet_ntoa(sin_client.sin_addr), ntohs(sin_client.sin_port));
fflush(stdout);

struct client_info* ci = client_info_alloc(sfd_client, connection_id++);
serve_client(ci);
}

close(sfd_server);
printf(ID "Done.\n");
fflush(stdout);

return 0;
}
开发者ID:theUserMan,项目名称:FTPServer,代码行数:42,代码来源:server_ftp.c


示例20: pthread_mutex_init

CAsyncLockingQueue::CAsyncLockingQueue()
{
	mQueue.clear();
	nInt32 res = pthread_mutex_init(&mLockMutex, NULL);
	if(res != 0)
	{
		nstring er("CAsyncLockingQueue::CAsyncLockingQueue() - can not create mutex section code: ");
		er.append(CStringUtils::IntTo16xString(res));
		throw NOVA_EXP(er.c_str(), BAD_OPERATION);
	}
}
开发者ID:Siriuscoder,项目名称:NovaEngine,代码行数:11,代码来源:nova_resource_manager.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ eraise函数代码示例发布时间:2022-05-30
下一篇:
C++ equals函数代码示例发布时间: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