高分求用C#做客户端,C++做服务端的网络编程实例(求源码)

peterlanhaijun 2006-02-08 06:22:09
公司要小弟近日用C#搞个网络客户端,可是兄弟我还没接触过网络编程。工期又紧,在不出东西有失业危险呀。恳请网上的朋友帮忙。
...全文
301 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
hy98521 2006-02-20
  • 打赏
  • 举报
回复
具体要实现什么样的功能呢?
peterlanhaijun 2006-02-20
  • 打赏
  • 举报
回复
略有所获。还有那位大哥来顶以下亚
peterlanhaijun 2006-02-09
  • 打赏
  • 举报
回复
试过了,得出空值
alesso 2006-02-09
  • 打赏
  • 举报
回复
char* 用string就行了吧
peterlanhaijun 2006-02-09
  • 打赏
  • 举报
回复
据公司使用delphi做客户端的兄弟说 ZLongTime函数输出的最终结果应该是“字符串”。

我在C#中如何得到这个“字符串”?
peterlanhaijun 2006-02-09
  • 打赏
  • 举报
回复
上面

C#代码如何得到ZLongTime的输入,得到的输出是什么C#格式。)

应该是

C#代码如何得到ZLongTime的输出,得到的输出是什么C#格式。)
peterlanhaijun 2006-02-09
  • 打赏
  • 举报
回复
C++写的服务端已经被别人写好了,还有数据的格式、加密等需要调用一个C++做的DLL中的函数。

而这个DLL中的函数大多都是用的char* uchar*这样的参数输出值。

用两个主要问题:1、在C#代码中如何得到这个DLL函数中char* uchar*的输出结果
(如:C++中的函数如此写 extern BZEX_API void ZLongTime(unsigned long ctime, char *buf);

C#中引用 [DllImport("bzex.dll",EntryPoint="?ZLongTime@@YAXKPAD@Z", SetLastError=true, CharSet=CharSet.Auto, ExactSpelling=true, CallingConvention=CallingConvention.Cdecl)]
static extern unsafe void ZLongTime(ulong ctime,这里该是什么参数);)

C#代码如何得到ZLongTime的输入,得到的输出是什么C#格式。)

zuozhiqiang_legend 2006-02-09
  • 打赏
  • 举报
回复
你最终要达到什么效果。
peterlanhaijun 2006-02-09
  • 打赏
  • 举报
回复
还有没有更详细的??
aSalt 2006-02-09
  • 打赏
  • 举报
回复
试一下
1 static extern unsafe void ZLongTime(ulong ctime,这里该是什么参数);
传入byte[]的引用或char[]的引用 (ref关键字)

2 ZLongTime 的格式,问DLL开发人员,ulong ctime 看名字像是完整的日期格式,精确到秒的.自己试吧,先考虑英文系统的默认格式
aSalt 2006-02-09
  • 打赏
  • 举报
回复

char* 其实就是 byte[]

需要先string to byte[],有很多例子,参考一下
peterlanhaijun 2006-02-09
  • 打赏
  • 举报
回复
急呀
yf1025 2006-02-09
  • 打赏
  • 举报
回复
很想帮你,可水平有限,只能帮顶了,顺便学习下
leyt 2006-02-08
  • 打赏
  • 举报
回复
f
zuozhiqiang_legend 2006-02-08
  • 打赏
  • 举报
回复
我和你现在的处境是一样的但我做的这个还有点问题,不过你可以参考一下。

public static byte[] serialzable()
{
byte []length=new byte[12];
_Head head=new _Head(100,1000,800);
IFormatter iformat=new BinaryFormatter();
Stream stream=new MemoryStream(length);
iformat.Serialize(stream,head);

BinaryReader br=new BinaryReader(stream);
return br.ReadBytes(length.Length);
}
[Serializable]
public struct _Head
{
public int Cmd_ID;
public int Pk_Length;
public int Status;
public _Head(int Cmd_ID,int Pk_Length,int Status)
{
this.Cmd_ID=Cmd_ID;
this.Pk_Length=Pk_Length;
this.Status=Status;
}
}
peterlanhaijun 2006-02-08
  • 打赏
  • 举报
回复
那位大哥有,有毛坯就也好三
califord 2006-02-08
  • 打赏
  • 举报
回复
对不起,没有呀

110,500

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧