1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
Pete,我假设您在Unix机器上没有VEE。我没有用VEE做过这个,但我参与了一个使用C和Java套接字的项目。
一般来说,我会说使用带Java的套接字非常简单,非常便携。 在C和Java中实现了相同的套接字协议,并且java代码在Unix上简单得多,在C语言中使用Windows API做同样的事情太痛苦了。这是我的通用评论,因为我不能 给你一个代码示例。做这些事情的技巧是为通过套接字的信息定义一个简单的协议。 如果它是VEE,C或Java无关紧要。 我个人最喜欢的是发送“数据包”,其中包含一些头字节集,然后是一批0或更多的信息字节。 在我的脑海中,一个数据包可能看起来像:int16数据包#,int16操作代码,int16字节信息,int16检查sumbytes []数组信息然后你可以监听完整的标题,看看它,然后听取字节 阵列。 把时间花在东西上,你可以恢复fromerrors。 在层中构建应用程序,以便您拥有构建和发送数据包的函数,接收和打包数据包的相应函数,以及执行foreach操作码的东西的单独函数,并理解该字节数组中应该是什么。 对于您的应用,您可以将100定义为“whatrev”的操作码,将101定义为回复什么版本。 字节数组可能是代码100的应用程序名称的字符串,字节是101的版本的字符串。数据包编号用于保存事物。 例如,回复与原始请求具有相同的包号。 每一方都可以尝试确保连续的数据包数,但并不总是需要它。 如果可以有多个请求未完成,则可以使用数据包编号将回复发送到正确的位置。 如果事情更加单一,那就更容易。想法? 这里的诀窍是做一个好的完整设计,然后实现和调试是直接的.lBill>大家好,>我想要做的是通过socket>连接从PC通信到UNIX盒子。 我希望PC在UNIX系统上执行命令并>通过套接字连接检索结果。 例如,有一个命令>'whatRev'将显示某些应用程序代码的修订版。 我想>把这个结果带回VEE程序。 有没有人这样做过>已经? 我不确定,但我想我可能要在UNIX端创建一个套接字端口>,因为我不确定我是否正在寻求帮助。>>谢谢,任何评论或输入.. >> Pete Thomas>测试工程师 - GE医疗系统> peter.thomas@med.ge.com------------------------------- --------------------------------------这是由Majordomo管理的“vrf”maillist。 要向该maillist发送消息,只需发送电子邮件至“vrf@lvld.agilent.com”。 订阅和取消订阅是通过地址“vrf-request@lvld.agilent.com”完成的。如果您需要详细信息,只需将包含“help”文本的消息发送到“vrf-request@lvld.agilent.com”.--- -------------------------------------------------- ---------------- 以上来自于谷歌翻译 以下为原文 Pete, I am assuming that you do not have VEE on the Unix box. I have not done this with VEE, but I have been involved in a project that used sockets in C and Java. In general, I'd say that using a socket with Java is pretty straight forward, and quite portable. We implemented the same socket protocol in C and Java, and the java code was a wee bit simpler on Unix, and it was too painful to do the same sorts of things with the windows API in C. Here is my generic comment, since I can't hand you a code example. The trick to doing these sorts of things is to define a simple protocol for the info going through the socket. Doesn't matter if it is VEE, C or Java. My personal favorite is to send "packets" which consist of some set of header bytes, then a batch of 0 or more info bytes. Off the top of my head, a packet may look like: int16 Packet #, int16 operation code, int16 bytes of info, int16 check sum bytes[] array of info Then you can listen for the full header, look at it, then listen for the byte array. Put time outs on stuff, and you can recover from errors. Build the app in layers, so that you have functions that build and ship packets, corresponding functions that recieve and unpack packets, and separate functions that carry out the stuff for each opcode and understand what is supposed to be in that array of bytes. For your app, you might define 100 to be the opcode for "whatrev" and 101 to be reply to what rev. The byte array might be the string for the name of the app for code 100, and the bytes are the string for the version for 101. The packet number is used to keep track of things. For instance a reply has the same packet number as the original request. Each side can try to ensure consecutive packet numbers, but it isn't always needed. If there can be multiple requests outstanding, the packet number can be used to send replies to the correct place. If things are more single minded, it is easier. Got the idea? The trick here is to do a good full design, then implementing and debugging is straight forward. lBill > Hello all, > what I'm trying to do is communicate from a PC to a UNIX box via a socket > connection. I would like the PC to execute a command on the UNIX system and > retreive the result via a socket connection. For example there is a command > 'whatRev' that will display the revision of some application code. I would > like to get this result back to the VEE program. Has anyone done this > already ?? I'm not sure, but I think I might have to create a socket port > on the UNIX side, as I'm not sure I'm looking for some help. > > Thanks, for any comments or input.. > > Pete Thomas > Test Engineer - GE Medical System > peter.thomas@med.ge.com --------------------------------------------------------------------- This is the "vrf" maillist, managed by Majordomo. To send messages to this maillist, just email to "vrf@lvld.agilent.com". Subscriptions and unsubscriptions are done through the address "vrf-request@lvld.agilent.com". If you need details, just send a message containing the text "help" to "vrf-request@lvld.agilent.com". --------------------------------------------------------------------- |
|
相关推荐
1个回答
|
|
大家好,我要做的是通过socketconnection从PC通信到UNIX机箱。
我希望PC在UNIX系统上执行命令,并通过套接字连接恢复结果。 例如,有一个命令'whatRev'将显示某些应用程序代码的修订版。 我想把这个结果带回VEE程序。 有人做过这个吗? 我不确定,但我想我可能要在UNIX端创建一个套接字端口,因为我不确定我是否正在寻求帮助。谢谢,任何评论或输入.Pete ThomasTest Engineer - GE Medical Systempeter.thomas@med.ge.com----------------------------------------- ----------------------------这是由Majordomo管理的“vrf”maillist。 要向该maillist发送消息,只需发送电子邮件至“vrf@lvld.agilent.com”。 订阅和取消订阅是通过地址“vrf-request@lvld.agilent.com”完成的。如果您需要详细信息,只需将包含“help”文本的消息发送到“vrf-request@lvld.agilent.com”.--- -------------------------------------------------- ---------------- 以上来自于谷歌翻译 以下为原文 Hello all, what I'm trying to do is communicate from a PC to a UNIX box via a socket connection. I would like the PC to execute a command on the UNIX system and retreive the result via a socket connection. For example there is a command 'whatRev' that will display the revision of some application code. I would like to get this result back to the VEE program. Has anyone done this already ?? I'm not sure, but I think I might have to create a socket port on the UNIX side, as I'm not sure I'm looking for some help. Thanks, for any comments or input.. Pete Thomas Test Engineer - GE Medical System peter.thomas@med.ge.com --------------------------------------------------------------------- This is the "vrf" maillist, managed by Majordomo. To send messages to this maillist, just email to "vrf@lvld.agilent.com". Subscriptions and unsubscriptions are done through the address "vrf-request@lvld.agilent.com". If you need details, just send a message containing the text "help" to "vrf-request@lvld.agilent.com". --------------------------------------------------------------------- |
|
|
|
只有小组成员才能发言,加入小组>>
1279 浏览 0 评论
2371 浏览 1 评论
2187 浏览 1 评论
2061 浏览 5 评论
2945 浏览 3 评论
1099浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
748浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
917浏览 0评论
1282浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 22:17 , Processed in 1.215254 second(s), Total 75, Slave 59 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号