Socket « open « C File Q&A

Home
C File Q&A
1.array
2.binary
3.delete
4.Development
5.directory
6.fgets
7.fopen
8.fprintf
9.fscanf
10.fwrite
11.header
12.include
13.input
14.LINE
15.linux
16.open
17.output
18.pointer
19.read
20.size
21.string
22.struct
23.Text
24.windows
25.write
C File Q&A » open » Socket 

1. Server not able to properly read/open a filename sent by client in C    stackoverflow.com

I'm doing client/server interaction with sockets in C. What I'm trying to do is have the client request a file to be read on the server, the server return a buffer ...

2. reading from the open socket then writing to a file...    cboard.cprogramming.com

void postmessage (int sock) { int i, bytesread; char buffer[255]; FILE *outputfile; write(sock, "Message?\n", 10); bzero(buffer,255); bytesread = read(sock, buffer, 255); printf ("read %d bytes >%s<\n", bytesread, buffer); fflush(stdout); if (bytesread < 0) { fprintf(stderr, "ERROR reading from socket"); return; } if ((outputfile = fopen("messages.txt", "w")) == NULL) { fprintf(stderr, "Cannot open %s\n", outputfile); return; } for (i = 0; i ...

3. writing a file to an open socket...    cboard.cprogramming.com

Do not write the file byte by byte to the socket. Each write is a message to the OS on the recv end, each will have to have a packet header ect, further increasing the overhead. You will probably create more WOULDBLOCK's this way. (the socket is busy/full and the info will need to be buffered and sent later, by your ...

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.