#include<peer.h>
int peer_choke(int sock, struct peer *info) {
- return -1;
+ unsigned char buf[5] = "\x00\x00\x00\x01";
+ buf[4] = PEER_MESSAGE_CHOKE;
+
+ return net_send(sock,info,buf,5);
}
int peer_unchoke(int sock, struct peer *info) {
- return -1;
+ unsigned char buf[5] = "\x00\x00\x00\x01";
+ buf[4] = PEER_MESSAGE_UNCHOKE;
+
+ return net_send(sock,info,buf,5);
}
#include<peer.h>
int peer_interested(int sock, struct peer *info) {
- return -1;
+ unsigned char buf[5] = "\x00\x00\x00\x01";
+ buf[4] = PEER_MESSAGE_INTERESTED;
+
+ return net_send(sock,info,buf,5);
}
int peer_not_interested(int sock, struct peer *info) {
- return -1;
+ unsigned char buf[5] = "\x00\x00\x00\x01";
+ buf[4] = PEER_MESSAGE_NOT_INTERESTED;
+
+ return net_send(sock,info,buf,5);
}