在C#中,Python的binascii.b2a_hex是否具有等效的功能?

时间:2019-10-14 22:04:24

标签: c# python unicode

我正在尝试从使用def send_withlen(self, data, log = True) : lengthstr = struct.pack(">L", len(data)) if log : logging.debug(str(self.address) + ": Sent data with length - " + binascii.b2a_hex(lengthstr) + " " + binascii.b2a_hex(data)) totaldata = lengthstr + data totalsent = 0 while totalsent < len(totaldata) : sent = self.send(totaldata, False) if sent == 0: raise RuntimeError, "socket connection broken" totalsent = totalsent + sent 的Python服务器中移植一些代码。我不知道任何C#等效项。 C#中的哪个函数会给我相同的结果?

我已经在网上查找,看是否有人有相同的问题,但尚未找到人。我什至在寻找第三方库。我确实使我的应用程序从Python脚本获得了结果,但我想可靠地移植代码。

2019-10-15 00:03:14,220 root         DEBUG    ('192.168.0.17', 59176): Sent data with length - 0000010a 01500a010000000000000400040000000c0000001200000004000400000005000000120000000400040000000000000003000000040004000000060000000e00000004000400000004000000110000000400040000000a000000110000000400040000000b000000626172000400040000000f0000000e0100000400040000000200000057000000040004000000030000000000000004000400000009000000666f6f0004000400000007000000626f6f000400040000000d000000666f6f0004000400000008000000fb0000000400240000000e000000015024000000000000000300040000006361631a00000003000400000063617308000000040004000000010000000e000000

2019-10-15 00:03:14,292 dirsrv       INFO     ('192.168.0.17', 59178): Sending out list of content list servers
2019-10-15 00:03:14,293 root         DEBUG    ('192.168.0.17', 59178): Sent data with length - 00000008 0001c0a800119d69

以下是一些记录器调试行的示例,其中显示了该函数输出的格式:

np.gradient

0 个答案:

没有答案