端口数据的传输的问题(0分)

  • 主题发起人 主题发起人 xiaoming99129
  • 开始时间 开始时间
X

xiaoming99129

Unregistered / Unconfirmed
GUEST, unregistred user!
大家好,请问大家,串口,并口,或者通过TCP/IP协议,在两种不同的机器上进行传输入数据的代码是怎样的,或者相应的文章?请大家给我解答一下,谢谢!
 
大家好,请问大家,怎样通过一台电脑用DELPHI去读取另一台通过并口或串口传过来的数据呢,谢大家帮忙解答一下,谢谢
 
function Receive_Data(var Receive_Buffer:array of byte;Read_Len:integer):boolean;<br>var<br> &nbsp;Clear:Boolean;<br> &nbsp;dwnumberofbytesread:dword;<br> &nbsp;errorflag:dword;<br>begin<br> &nbsp; &nbsp;fillchar(Receive_Buffer,Read_Len,#0);<br> &nbsp; &nbsp;while true do<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;Clear:=Clearcommerror(com_handle,errorflag,@Comstate);<br> &nbsp; &nbsp; &nbsp; &nbsp;if comstate.cbInQue&gt;=read_len then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br> &nbsp; &nbsp; &nbsp; &nbsp;if not clear then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result:=false;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end ;<br> &nbsp; &nbsp; &nbsp; &nbsp;sleep(25);<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;if Comstate.cbInQue=0 then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result:=false;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end; &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp;if comstate.cbInQue&gt;0 then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (not readfile(com_handle,receive_buffer[0],read_len,dwnumberofbytesread,@read_os)) then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result:=false;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if dwnumberofbytesread&gt;0 then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;read_os.Offset:=read_os.Offset+dwnumberofbytesread;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; result:=true;<br>end;
 
两台计算机串口可以对发么?这个倒没有认真去考虑过?不过想想也应该一样的吧?<br>想做成两台计算机串口通信么?这样吧,串口接出自已做一个RS232传换RJ45的这样不可以了么?
 
后退
顶部