TCP « Development « C Q&A

Home
C Q&A
1.assembly
2.buffer
3.Card
4.Cast
5.compile
6.console
7.const
8.constructor
9.database
10.Date
11.Debug
12.Design
13.Development
14.DLL
15.encrypt
16.enum
17.eof
18.Event
19.fork
20.Format
21.gcc
22.gdb
23.graph
24.graphics
25.gui
26.Holiday Event
27.image
28.IP
29.iterator
30.macro
31.makefile
32.malloc
33.Menu
34.mysql
35.network
36.openssl
37.operator
38.password
39.pipe
40.preprocessor
41.printf
42.pthread
43.Regular expression
44.scanf
45.semaphore
46.SerialPort
47.server
48.Socket
49.sql
50.SQLserver
51.sscanf
52.std
53.stdin
54.stdout
55.stl
56.strcmp
57.stream
58.switch
59.Template
60.thread
61.timer
62.unix
63.video
64.Virtual
65.visualstudio
66.winapi
67.windows
68.xml
C Q&A » Development » TCP 

1. Segmentation Fault in TCP communication    stackoverflow.com

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) {

  ...

2. Uses of SO_REUSEADDR?    stackoverflow.com

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 ...

3. Building an http packet in libnet(tcp packet), Please help us as soon as posible. we are stuck!    stackoverflow.com

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 ...

4. Send Packets through IPERF    stackoverflow.com

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 ...

5. Error and unexpected behavior with TCP connection    stackoverflow.com

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 ...

6. using select() to listen to multiple clients (TCP)    stackoverflow.com

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 ...

7. Configurable rate and pattern when implement tcp ping in C    stackoverflow.com

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 ...

8. Multiple TCP connections in C    stackoverflow.com

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 ...

9. tcp message communications    stackoverflow.com

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 ...

10. What does a Connection Timeout mean in the context of a select() call    stackoverflow.com

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 ...

11. How can i catch a runtime error in ansi C90    stackoverflow.com

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 ...

12. CR/LF condition check in C    stackoverflow.com

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 ...

13. C: expected specifier-qualifier-list before "tcp_seq"    stackoverflow.com

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 ...

14. How can I add code to a libnodave test program (testISO_TCP simplified) that protects the read routine from crashing?    stackoverflow.com

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 ...

16. TCP-based chat program    bytes.com

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 ...

17. TCP apllications    bytes.com

On Jun 6, 4:02*pm, Arun

18. Probing for TCP Connections    bytes.com

19. Looking for information about TCP connections    bytes.com

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 ...

20. [1/2OT] a buggy TCP client program    bytes.com

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 ...

21. A tcp connetion question    bytes.com

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?

22. multiple TCP connections    bytes.com

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 ...

23. TCP send    bytes.com

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 ...

24. TCP Connection    bytes.com

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. ...

25. Segmentation fault on TCP recv    cboard.cprogramming.com

> //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 ...

26. TCP Psuedo headers    cboard.cprogramming.com

27. TCP Header problem (error)    cboard.cprogramming.com

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 ...

28. Opening tcp ports?    cboard.cprogramming.com

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 ...

29. Get tcp source port?    cboard.cprogramming.com

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 ...

30. TCP Echo Client - recv() hangs indefinitely    forums.devshed.com

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 ...

31. How to send a tcp packet using libpcap?    forums.devshed.com

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.com

Sockets 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.com

I 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 ...

34. TCP Port forwarding    forums.devshed.com

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,

35. Creating a tcp conn    forums.devshed.com

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 ...

36. tcp header for echo communication    forums.devshed.com

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 ...

37. altering tcp payload    forums.devshed.com

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 ...

38. netinet/tcp.h    forums.devshed.com

39. Tcp    forums.devshed.com

40. Manipulation of TCP sliding window size in Win2k    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 ...

41. is/would this be a possible way to counter tcp syn floods    forums.devshed.com

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 ...

42. keeping multiple tcp connections open after one closes    forums.devshed.com

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, ...

43. tcp window size    forums.devshed.com

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 ...

44. Can't send RTP data after accepting TCP connection    forums.devshed.com

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 ...

45. building a TCP SYN packet ... need help please ...    forums.devshed.com

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 ...

46. TCP implementation    daniweb.com

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 ...

47. TCP Ping    daniweb.com

48. Kernel Module for TCP Packet Edition    daniweb.com

#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 ...

49. tcp client code    daniweb.com

50. Trying to create a TCP Client    codeproject.com

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 ...

51. How To Reassemble TCP Packets    codeproject.com

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 ...

52. open tcp port using AT Command?    codeproject.com

53. How to Reassemble TCP Packets    codeproject.com

// 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) ...

54. tcp linking    codeproject.com

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(); }

55. PPP over dialup failing to transfer tcp packets with out ethernet cable    codeproject.com

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 ...

56. TCP sequencing help :)    codeproject.com

57. Telnet client using TCP    codeproject.com

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 ...

58. How to reassemble TCP packets    codeproject.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.