EasyManua.ls Logo

YASKAWA MP3000 Series - Page 369

YASKAWA MP3000 Series
435 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2.13 Communications with a Windows PC (Visual C++ Application)
Using Automatic Reception with the MP3000 as a Slave
2-351
Ethernet Communications
rc = -3;
return( rc );
}
}
return(rc);
}
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/ Send command data, receive response data /
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
int memobus_msg( unsigned short trans_prt, char sbuf, char rbuf )
{
int rc;
if( trans_prt == TCP_PRT)
{
rc = tcp_msg(sbuf, rbuf);
}
else
{
rc = udp_msg(sbuf, rbuf);
}
return(rc);
}
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/ Send command data, receive response data (TCP) /
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
int tcp_msg( char sbuf, char rbuf )
{
int slen, rlen;
int rc = 0;
// Send command data
slen = send( sd, sbuf, DATAi, 0 );
if ( slen != DATAi ) // Returns the number of bytes sent if sending was successful
{
closesocket(sd);
rc = -1;
return ( rc );
}
// Receive response data
rlen = recv( sd, rbuf, DATA_SIZE, 0 );
if ( rlen <= 0 ) //A 0 or less value is returned if receiving failed
{
closesocket(sd);

Table of Contents

Other manuals for YASKAWA MP3000 Series

Related product manuals