如何通过套接字发送数据包? [英] How Do I Send Packets Trough A Socket?

查看:74
本文介绍了如何通过套接字发送数据包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在玩数据包,到目前为止我能够理解这么好,但我想知道我怎么能发送数据包?



示例包:

Hello all, i am playing around with packets, and i am able to understant so far so good, but i was wondering how can i send packets?

Example packet :

0XC1 0X02 0X04





我的绕行功能是:





And my function for detour is:

int WINAPI mysend(SOCKET s, BYTE* buf, int len, int flags)





请问一个例子?



An example please?

推荐答案

unsigned char buf[] = {0XC1 0X02 0X04};
int rc = mysend( sd, buf, sizeof(buf), f);
// here check the result code rc



其中 sd 是你的套接字描述符, f 是你的标志。


where sd is your socket descriptor and f are your flags.


这篇关于如何通过套接字发送数据包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆