有人有FD的有果体补丁的手游吗

买别人fd抓包的手机被逮到了怎么处理?或者犯什么法? - 110网免费法律咨询
您的位置:
&& 查看咨询        今日活跃律师: &&&&&&&&&&
该问题已关闭
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
的回复获得奖章一枚
买别人fd抓包的手机被逮到了怎么处理?或者犯什么法?
河南-安阳&05-14 21:31&&悬赏 0&&发布者:ask201…… & 回答:(0)
买别人fd抓包的手机被逮到了怎么处理?或者犯什么法?
您也有法律问题? 您可以 发布咨询,我们的律师随时在线为您服务
问题答案可能在这里 →
无锡推荐律师
最佳律师解答
(章燕专业)()&
(李建成)()&
(龙宇涛)()&
(南智军)()&
(李晓航)()&
最新回复律师
人气:416000
人气:74109
上海 普陀区
人气:174051
天津 南开区
人气:29268
北京 朝阳区
人气:601829
天津 宝坻区
人气:24010I don't know why I'm having a hard time finding this, but I'm looking at some linux code where we're using select() waiting on a file descriptor to report it's ready. From the man page of select:
select() and pselect() allow a program to monitor multiple file descriptors,
waiting until one or more of the file descriptors become "ready" for some
class of I/O operation
So, that's great... I call select on some descriptor, give it some time out value and start to wait for the indication to go. How does the file descriptor (or owner of the descriptor) report that it's "ready" such that the select() statement returns?
解决方案 It reports that it's ready by returning.
select waits for events that are typically outside your program's control. In essence, by calling select, your program says "I have nothing to do until ..., please suspend my process".
The condition you specify is a set of events, any of which will wake you up.
For example, if you are downloading something, your loop would have to wait on new data to arrive, a timeout to occur if the transfer is stuck, or the user to interrupt, which is precisely what select does.
When you have multiple downloads, data arriving on any of the connections triggers activity in your program (you need to write the data to disk), so you'd give a list of all download connections to select in the list of file descriptors to watch for "read".
When you upload data to somewhere at the same time, you again use select to see whether the connection currently accepts data. If the other side is on dialup, it will acknowledge data only slowly, so your local send buffer is always full, and any attempt to write more data would block until buffer space is available, or fail. By passing the file descriptor we are sending to to select as a "write" descriptor, we get notified as soon as buffer space is available for sending.
The general idea is that your program becomes event-driven, i.e. it reacts to external events from a common message loop rather than performing sequential operations. You tell the kernel "this is the set of events for which I want to do something", and the kernel gives you a set of events that have occured. It is fairly common for two events occ for example, a TCP acknowledge was included in a data packet, this can make the same fd both readable (data is available) and writeable (acknowledged data has been removed from send buffer), so you should be prepared to handle all of the events before calling select again.
One of the finer points is that select basically gives you a promise that one invocation of read or write will not block, without making any guarantee about the call itself. For example, if one byte of buffer space is available, you can attempt to write 10 bytes, and the kernel will come back and say "I have written 1 byte", so you should be prepared to handle this case as well. A typical approach is to have a buffer "data to be written to this fd", and as long as it is non-empty, the fd is added to the write set, and the "writeable" event is handled by attempting to write all the data currently in the buffer. If the buffer is empty afterwards, fine, if not, just wait on "writeable" again.
The "exceptional" set is seldom used -- it is used for protocols that have out-of-band data where it is possible for the data transfer to block, while other data needs to go through. If your program cannot currently accept data from a "readable" file descriptor (for example, you are downloading, and the disk is full), you do not want to include the descriptor in the "readable" set, because you cannot handle the event and select would immediately return if invoked again. If the receiver includes the fd in the "exceptional" set, and the sender asks its IP stack to send a packet with "urgent" data, the receiver is then woken up, and can decide to discard the unhandled data and resynchronize with the sender. The telnet protocol uses this, for example, for Ctrl-C handling. Unless you are designing a protocol that requires such a feature, you can easily leave this out with no harm.
Obligatory code example:
#include &sys/types.h&
#include &sys/select.h&
#include &unistd.h&
#include &stdbool.h&
static inline int max(int lhs, int rhs) {
if(lhs & rhs)
void copy(int from, int to) {
char buffer[10];
int readp = 0;
int writep = 0;
bool eof =
fd_set readfds,
FD_ZERO(&readfds);
FD_ZERO(&writefds);
int ravail,
if(readp & writep) {
ravail = writep - readp - 1;
wavail = sizeof buffer -
ravail = sizeof buffer -
wavail = readp -
if(!eof && ravail)
FD_SET(from, &readfds);
if(wavail)
FD_SET(to, &writefds);
else if(eof)
int rc = select(max(from,to)+1, &readfds, &writefds, NULL, NULL);
if(rc == -1)
if(FD_ISSET(from, &readfds))
ssize_t nread = read(from, &buffer[readp], ravail);
if(nread & 1)
readp = readp +
if(FD_ISSET(to, &writefds))
ssize_t nwritten = write(to, &buffer[writep], wavail);
if(nwritten & 1)
writep = writep +
if(readp == sizeof buffer && writep != 0)
readp = 0;
if(writep == sizeof buffer)
writep = 0;
We attempt to read if we have buffer space available and there was no end-of-file or error on the read side, and we attempt to write if we hav if end-of-file is reached and the buffer is empty, then we are done.
This code will behave clearly suboptimal (it's example code), but you should be able to see that it is acceptable for the kernel to do less than we asked for both on reads and writes, in which case we just go back and say "whenever you're ready", and that we never read or write without asking whether it will block.
本文地址: &
我不知道为什么我有一个很难找到这一点,但我在看一些Linux code,我们使用的是选择在哪里()等待一个文件描述符来报告它的准备。从选择的手册页: 选择()和PSELECT()允许程序监视多个文件描述符,等待,直到一个或多个文件描述符成为“准备”某些一流的I / O操作 所以,这是伟大的...我叫选择一些描述,给它一些时间的价值,并开始等待指示去。如何文件描述符(或描述符的所有者)报告说,这是“准备”,使选择()语句返回?解决方案 据报道,它的准备的按的回来了。 选择等待那通常是你的程序的控制之外的事件。从本质上讲,通过调用选择,你的程序说:“我什么都没有做,直到......,请停止自己的过程。”您指定的条件是一组事件,其中任何一个都会叫你起床的。例如,如果你正在下载东西,你的循环将不得不等待新的数据到达,出现了超时,如果在传输卡住,或者用户中断,这是precisely什么选一样。当你有多个下载,到达在任何连接数据触发程序中的活动(你需要将数据写入到磁盘),所以你愿意付出所有的下载连接的列表,以在文件描述符的列表中选择来观看“读”当您在同一时间将数据上传到某个地方,您再次使用选择来看看连接是否目前接受的数据。如果对方是拨号,将确认数据仅供慢,所以当地的发送缓冲区总是充满,任何试图写入更多的数据会阻塞,直到缓冲区空间可用,或者失败。通过传递我们发送的文件描述符选择作为一个“写”描述了,我们想尽快通知缓存空间可用于发送。总的想法是,你的程序变成的事件驱动的,即它的反应从一个普通的消息循环,而不是执行顺序操作外部事件。你告诉内核“,这是一套为我想要做的事事件”,内核为您提供了一组已发生的事件。这是两个事件同时存在的相当普遍;例如,TCP确认被列入一个数据包,这样可以使同样的FD可读(的数据)和可写(确认数据已经从发送缓冲区删除),所以你应该ppared处理所有$ P $事件之前调用选择试。一个细微之处是,选择基本上是给你一个承诺,的一个调用读或写将不会阻止,未做关于呼叫本身的任何保证。例如,如果缓冲空间一个字节是可用的,你可以尝试写10个字节,内核就会回来,说:“我已经写了1字节”,所以你应该ppared来处理这种情况,以及$ P $ 。一个典型的方法是让一个缓冲器“的数据被写入到这个FD”,并且只要它是非空,fd被添加到写集合,而“写”事件是由试图写入所有处理当前在缓冲器中的数据。如果缓冲区为空之后,罚款,如果没有,就等着上“写”了。的“例外”集很少使用 - 它是用于具有外的带外数据,其中有可能将数据传送到块中,而其他的数据需要经过协议。如果你的程序目前不能从一个“可读”的文件描述符接收数据(例如,您正在下载,并且磁盘已满),你不希望包含在“读”中设定的描述,因为你不能处理事件和选择将立即返回,如果再次调用。如果接收器包括在“例外”集的FD,并且发件人要求其IP栈来发送的分组中包含“紧急”的数据,接收机然后唤醒,并且可以决定丢弃未处理数据和与该发送者重新同步。在远程登录协议使用此,例如,按Ctrl-C处理。除非你正在设计一个需要这样的功能的协议,可以方便的与没有坏处离开了这一点。强制性code例如: 的#include< SYS / types.h中>#包括LT&; SYS / select.h>#包括LT&;&unistd.h中GT;#包括LT&;&stdbool.h GT;静态内嵌INT MAX(INT LHS,RHS INT){
如果(左>右)
返回RHS;}虚空副本(从int,int值){
炭缓冲液[10];
INT READP = 0;
INT WRITEP = 0;
布尔EOF = FALSE;
FD_SET readfds,
FD_ZERO(安培; readfds);
FD_ZERO(安培; writefds);
INT ravail,
如果(READP< WRITEP){
ravail = WRITEP
wavail = sizeof的缓冲 -
ravail = sizeof的缓冲 -
wavail = READP
如果(!EOF和放大器;&安培; ravail)
FD_SET(从,&安培; readfds);
如果(wavail)
FD_SET(于&安培; writefds);
否则,如果(EOF)
INT RC =选择(MAX(从,到)+1,和放大器; readfds,&安培; writefds,NULL,NULL);
如果(RC == -1)
如果(FD_ISSET(从,&安培; readfds))
ssize_t供NREAD =读取(从,&安培;缓冲区[READP],ravail);
如果(NREAD&。1)
EOF = TRUE;
READP = READP + NREAD;
如果(FD_ISSET(于&安培; writefds))
ssize_t供nwritten =写(于和放大器;缓冲区[WRITEP],wavail);
如果(nwritten&。1)
WRITEP = WRITEP +
如果(READP == sizeof的缓冲放大器&;&安培;!WRITEP = 0)
READP = 0;
如果(WRITEP == sizeof的缓冲区)
WRITEP = 0;
}} 我们试图读取,如果我们有可用的缓冲空间,也没有在读出侧档案结尾或错误,我们尝试写入,如果我们在缓冲区中的数据;如果达到结束文件和缓冲器是空的,那么我们完成这code将表现明显欠佳(这是例如code),但你应该能够看到,这是可以接受的内核做不到我们要求无论在读取和写入,其中情况下,我们只是回去说:“当你准备好”,而我们从来没有读取或写入不问是否会阻塞。
本文地址: &
扫一扫关注官方微信}

我要回帖

更多关于 带有裸体补丁的游戏 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信