I'm getting a segmentation fault in the following C code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define PORT 6667
#define MAXDATASIZE 1024
int bot_connect(char *hostname);
int bot_connect(char *hostname) {
...
|
I have used SO_REUSEADDR to have my server which got terminated to restart with out complaining that the socket is already is in use. I was wondering if there are other ... |
we are building a NAT program,we change each packet that comes from our internal subnet,
change it's source IP address by libnet functions.( catch the packet with libpcap, put it
sniff ... |
I have problem and its about using IPERF . It sends one packet at a time so to use it to fuzz IPv6 I want to send 10000 or 1000000 packets ... |
I am wanting my TCP server and client to "talk" to each other depending on what the other says. But when I run, it seems to go through one iteration, but ... |
I have developed (TCP) server to listen to a client and interact with it. Now I'm trying to adapt that server code to listen to mulitple clients. I am wanting to ... |
i am trying to implement a tcp ping function. And I hope to make the rate and pattern of sending messages configurable. For example, send 5000 msg in 5 seconds, burst ... |
|
Iam newebie to C socket programming. Here is my question :
Can a process open/maintain 2 TCP connections parellely ? [ for sending and receiving ].
I tried the following sceanrio :
1) Client ... |
hi i want to use tcp connection to send/recv messages. The question is i want to send many messages and measure the latencies. Thus, I don't want to receive after every ... |
I've noticed that sometimes select returns with Connection Timed out set on errno, but I dont know why it would do this, how would it know? And how are you suppose ... |
I am using the library Function ConnectToTCPServer. This function times out when the host is not reachable. In that case the application crashes with the following error:
"NON-FATAL RUN-TIME ... |
I am testing my TCP echo server, with Telnet, I can see that the client connects to the server and sends a charcter and in return the server returns a string ... |
I keep getting this error: expected specifier-qualifier-list before ‘tcp_seq’ in my header file.
Here is the header file:
#include <netinet/ip.h>
/* TCP header */
struct sniff_tcp {
u_short th_sport; /* source port ...
|
I will start by saying that I am a college student with little c++ experience. How many times have you heard that right? I am working with the test program testISO_TCP ... |
|
I wrote a little UDP-based chat program. It's not very user-friendly, requiring every user to add every other user to a list. Anyway, I want to adapt it to TCP so you don't have to do that, as well as the ability to talk to people behind firewalls without reconfiguring them. The first problem I have is how to have the ... |
|
|
Hello, me and 2 fellow students are busy working on our endterm project at school. The assignment consists of a cross platform multimedia application (a game in our project) that can be compiled on Windows, Linux or Apple. We have extended our client to have online capababilities, but I'm having trouble finding decent information about making cross platform TCP or UDP ... |
P: n/a RoS in windows xp the problem is that if i have a tcp sever istalled in the port 1000 in my computer, and "cli.exe" is the C program "client program" below and type cli 127.1.1.1 1000 connect of client fail with "WSAECONNREFUSED 10061" don't understand why there is someone expert in this there? what is the answer? then there ... |
They r two processes, for client and server, connected with TCP. Connection is OK. I killed the server process, while the client seems not to feel that before it sent some data by calling send(). And it checked the errno, which indicated a segmentation fault error. Why should it be segmentation fault rather than something indicating disconnection? |
Hi c++ guru's I need your help. I have 4 machines and I need them to be able to communicate to each other via peer to peer architecture. I know that when we have two machines one machine acts as a client and the other one as a server. the server machine just listens for incoming connections. My question is if ... |
Hi all, I am writing an application that sends and receives large amount of data to and from a server. I want to encode each packet similar to a struct such that, each message has a 4 bit code (determining how it should be parsed on the other end) as well as other info such as name, uid, x and y ... |
Hi, I am a novice programmer. I am trying to write a server-client program as a personal project. I have googled my ass off but I can't seem to find usefull information about this. Can anyone help me find information on how to make a connection between a client and a server over 'the internets' using TCP. Thank you kindly, Zero. ... |
> //copy socket > memcpy(&newFD, &incomingSocketFD, sizeof(incomingSocketFD)); Tell me, is this a thread function? Show us how you invoke this thread - in particular, details of the thread parameter pointer. Is this a pointer to a local variable (this is almost always a bug). Some points, 1. the size you're copying is sizeof(void*), not the size of an integer 2. &incomingSocketFD ... |
|
TCP Header problem (error) hello, Previously I got this short of problem and solved also but this time not getting the result. Some one has given idea but that didn't work. so if you people give me the right reply that should be nice for me. These are the errors......... tcpg.c: In function tcpg_hping: tcpg.c:97: error: struct tcphdr has no member ... |
Window's socket layer is fairly compatible. Most of the function calls are the same, so what is in the guide that cwr posted can be applied on Winodws. On Windows you can also get messages sent to Windows whenever a socket is ready for read/write... but that'll kill any portability. The two biggest differences between sockets in Windows & Linux, at ... |
Code: #include #include #include #include #include #include #include #include u_int16_t handle_ethernet( const struct pcap_pkthdr* pkthdr, const u_char* packet) { struct ether_header *eptr; eptr = (struct ether_header *) packet; struct ip* my_ip; my_ip = (struct ip*) (packet + sizeof(struct ether_header)); struct tcphdr *tcp; tcp = (struct tcphdr*) (packet + sizeof(struct my_ip *)); /*fprintf(stdout,"ethernet header ... |
Whiskey Tango Foxtrot, Oscar? Wherever did you get that example of how to use select? Because I cannot see how that abortion could possibly work! Or even compile! while (select (s+1, %readfds, NULL, NULL, %tv) > 0)){ Not only do you have mismatched parentheses (2 open and 3 close), but the modulo operator, %, is a binary operator, meaning that it ... |
Hai all, Im a newbie. I have to send a packet using libpcap ,C. I have written a prog but s not working. I don know wat s the mistake i have done. If anyone knows plz help me. Im struggling with these for past 3 days. I need to submit it tomorrow. here is the code : #include #include ... |
32. TCP program forums.devshed.comSockets programming actually isn't that complicated. The hard part is in getting some of the concepts down, mainly TCP/IP concepts, and in watching out for a few common "got'cha's" (eg, blocking sockets). The really good news is that you do not need any special software tools to do sockets programming; any up-to-date C/C++ compiler has sockets support built in. "Beej's Guide ... |
33. TCP to SCTP forums.devshed.comI have a program which uses a SOCK_STREAM (TCP) socket to receive text sent from client which telnets to the server. The server then sends the received text to all connected clients. I was just wondering if it's possible to convert this application to use SCTP? I was thinking that if telnet uses TCP port 23, then youwill no longer be ... |
Hi, I would like to forward TCP trafic, say HTTP, through a different port, say 8888. Has anyone got any references on how to go about doing that? To be more precise, I want my web browser's HTTP requests to go through a local port (6666), and all incoming trafic to 6666 be forwarded to port 80 (HTTP). Thanks all, |
Hello, This is totally unrealted to my other thread, i need to make some code to open a tcp port (server) and wait for a client. Whence a client opens a port and creates a connection, the client sends a packet to the server, and the server replys with a pre-defined response. I then need to be able to send a ... |
I am attempting to construct a TCP header for a simple echo server program using header fields: type, reserve1, reserve2, data length, sequence number, and data. Type will be a char variable whereas chracter 8 will represent an echo request message and 0 will represent an echo reply message. The reserved fields will be of value zero for now. Data will ... |
Hey, Can someone point me in the right direction for for information on altering tcp payloads? I'm putting together a content filter that intercepts and modifies data on port 80. On a match, I'd like to be able to alter the payload that the browser receives. I'm planning on using libpcap to sniff the interface (since it's cross-platform), but I'm not ... |
|
39. Tcp forums.devshed.com |
Hello, Does anyone know how to manually change the size of the TCP sliding window in Windows 2000? I am NOT talking about the TCP window size in the TCP header( that's the same as the Receive Buffer Size; I know how to set that in the registry.) The sliding window size is the number of packets that can be transmitted ... |
i imagine in a syn flood an attacker has a group of machines which they control with a remote control program. if they are smart all possible header fields are randomized. but i imagine each computer under the attackers control is located in different geographical locations, so the rtt varies. so if the attacker starts all of his zombies at the ... |
keeping multiple tcp connections open after one closes i have this chat program. clients connect to the server, and the server broadcasts messages that it recieves. the server is multithreaded, and the clients are single threaded. my problem is that when one client logs off the server starts getting errors. i think it closes the socket when one client signs off, ... |
I've been reading a bunch of stuff on this topic, understanding some, being baffled by the rest, BUT... from what i've understood, changing the tcp window size lets u raise the maximum size of a packet that you can recieve, but the catch is that you cant change the amount that the server will send to you. But if were to ... |
Hello, i'm a Telecomunication student with a question about using the Real Time Protocol implemented in Common Multimedia Library (URL). First i'll try to explain our purpose on using this library. We are sending video using several protocols. One of them is RTP. First, we create a TCP Stream to negotiate some parameters. After that, we want to use the TCP ... |
i'm working on a TCP IP project right now. And i got a problem with my code for sending a TCP SYN packet. The code supposed to be generate a TCP SYN packet and send it to a receiver. but the TCP SYN seems to be not valid because the receiver didn't response it, just ignore it. So, would anybody please ... |
This is a non-trivial task. There are many questions that you've left unanswered to help us help you. As an assignment, is this part of some larger context system you must fit into? For instance, is there an API for communicating with your upper and lower layers? Are you using a Linux-based stack? Windows? What version of TCP do you wish ... |
|
#include #include #include #include #include #include #include #include #include #include #include #include MODULE_LICENSE("GPL"); MODULE_AUTHOR("csurfer"); MODULE_DESCRIPTION("Packet Sniffer"); static struct nf_hook_ops netfilter_ops_out; /* NF_IP_POST_ROUTING */ struct tcphdr *tcp_header; struct sk_buff *sock_buff; struct iphdr *ip_header; int dadd,sadd,bit1,bit2,bit3,bit4; struct net_device * dev; /* Function prototype in */ unsigned int main_hook(unsigned int hooknum, struct ... |
|
Well... The point is ,, You both have the point , yet , there is small "issue" here ... Like, there is a perfect client/server over TCP solution written in C++ AND C# right here on this site , which leads me to conclusion that some1 is too lazy to SEARCH ??? Bah ... try typing in ... |
If you sniff on a switched network, where no span has been configured, you get only broadcasts and unknown destinations. If you see a flow, you can resemble them by taking packets belonging to the same sorce-address&port-to-destination-address&port quartet by sorting in respect to their sequence. But that "flow" may be its not a "flow of data": depending on what the application ... |
|
// http://www.ietf.org/rfc/rfc1700.txt?number=1700 #pragma warning( disable: 4996 ) #include "StdAfx.h" #include #include #include #include #include #include #include #include #include #include #pragma comment( lib, "ws2_32.lib" ) // linker must use this lib for sockets // *** Prototypes void translate_ip(DWORD _ip, char *_cip); void decode_tcp(char *_packet); void decode_icmp(char *_packet); void decode_udp(char *_packet); void get_this_machine_ip(char *_retIP); // *** Defines and Typedefs #define LS_HI_PART(x) ((x>>4) ... |
i need to send this event d->asyncEvent.printOn(std::cout); to the server.. and link it using tcp....hav to some modification in the followng part of the program.. void testCFTcpServer() { CFTcpServer server; int port = 8000; if(!server.setup(port)) { std::cout << std::endl << "server setup failed"<< std::endl; return; } std::cout << std::endl << "server running"<< std::endl; CFRunLoopRun(); } |
You shouldn't post more information neither messages to other users as answers... The idea here is to use "Improve question" to add more details to your question (go figure) and to use "Add Comment" or "reply" to comment a specific answer or comment from another user... Doing that like you've done it, nobody apart from you and new CPians that look ... |
|
Thats is because you dont send "telnet 111.1.112.11 -l user" to the server, that is what you tpye into your console. that runs the telnet program which interprets the heap of junk that goes back and forth. Either read up on the telnet protocol, or get a packet sniffer such as Wireshark[^] and record the session to ... |
|