Sponsored Content
Full Discussion: Help with sockets in C
Top Forums Programming Help with sockets in C Post 302510153 by Corona688 on Friday 1st of April 2011 04:29:59 PM
Old 04-01-2011
Quote:
Originally Posted by omega666
i just changed all of them to strlen, and the problem still occurs
You can't just blindly make the changes without making the other fixes I said too. Your code makes a lot of wrong assumptions about the behavior of sockets. It doesn't operate as expected because sockets don't either.
Quote:
how is read supposed to work, does it normally skip the \n characters?
Now you ask, after I've been trying to point it out for weeks...

read() works completely raw. It alters none of the data that passes through it. It doesn't do anything special to nulls or newlines, and nothing in the data makes it stop early. It might stop early for other reasons though, so you have to check its return value, to see if you read as many bytes as you thought you did. write() is the same. completely raw. But you have to check its return value in case it wrote less than you asked it to.
 

10 More Discussions You Might Find Interesting

1. Programming

sockets...

Hi ! I had a verry simple question to ask... In unix when we create pipes.. the unnamed pipes that is... is there any way to access those pipes outside the code ? Another thing.. do sockets have an entry in the inode table ? TIA, Devyani. (1 Reply)
Discussion started by: devy8
1 Replies

2. Programming

Sockets!?!?!?!?!?!

I am looking for a way to have a program listen on a port (example: 8000) for communication I will be sending via that port to it(Linux Kernel machine). Once it recieves an appropiate command I need it to run a .bat file in linux. I know what I need to do but I am running into a few problems:... (8 Replies)
Discussion started by: bigB8210
8 Replies

3. Programming

sockets

Hai, How cani declare socket and collect the data in a string varialbe. Since i am new to this i am asking this. Can we connect multiple port. Thank you. (6 Replies)
Discussion started by: arunkumar_mca
6 Replies

4. UNIX for Dummies Questions & Answers

sockets

how do i mointor how many sockets are opened from a particular foriegn address? (2 Replies)
Discussion started by: kirpond
2 Replies

5. Solaris

Sockets in use

Is there a way to see what sockets are in use? The developers here are getting some defunct processes and they would like to get a socket list. This is on a Solaris 8 machine. Thanks! (1 Reply)
Discussion started by: kjbaumann
1 Replies

6. IP Networking

sockets and firewall

Is it possible to trace the packages and the statuses of client's and/or server's sockets by the UNIX network administrative tools? Two applications interact via sockets. There is no problem if they stay in the same network segment. If their hosts connected through the firewall then they aren't... (4 Replies)
Discussion started by: gogogo
4 Replies

7. Programming

need help with sockets

anyone and teach me how to save standard output to a file in a client/server socket. I know how to read them to the screen but i'm not quite sure how to save them to a file. my read to screen file code: memset(line, 0x0, LINE_ARRAY_SIZE); while (recv(connectSocket, line, MAX_MSG, 0) >... (1 Reply)
Discussion started by: crunchyuser
1 Replies

8. Programming

Sockets

Hi,i now moved into a different section where i need to use sockets. i am completely nill in sockets. can some body please provide me what are the requirements for a socket. to use sockets in c. thanks (1 Reply)
Discussion started by: MrUser
1 Replies

9. Red Hat

Sockets

hai guys, I'm doing a project in which one server communicates with several clients. How can i do it when i have different port numbers???:confused: (0 Replies)
Discussion started by: rajeshb6
0 Replies

10. Programming

Any example about sockets in C++?

Hi, i am student, think learning about c++, someone has a example the how establish a conection with sockets :b::b: (1 Reply)
Discussion started by: mmartinez
1 Replies
PERLBEOS(1)						 Perl Programmers Reference Guide					       PERLBEOS(1)

NAME
README.beos - Perl version 5 on BeOS DESCRIPTION
Notes for building Perl under BeOS. General Issues with Perl on BeOS To compile perl under BeOS R4 x86: ./Configure -d and hit ^C when it asks you if you want to make changes to config.sh; edit config.sh and do the following: change d_socket='define' to ='undef'; remove SDBM, Errno, and Socket from dynamic_ext= and nonxs_ext=; add '#define bool short' to x2p/a2p.h; ../Configure -S; make; make install cd ~/config/lib; ln -s 5.00502/BeOS-BePC/CORE/libperl.so . (substitute 5.00502 with the appropriate filename) BeOS Release-specific Notes R4 x86 Dynamic loading finally works! Yay! This means you can compile your own modules into perl. However, Sockets and Errno still don't work. (Hopefully, sockets will at least work by R5, if not sooner.) R4 PPC I have not tested this. I rather severely doubt that dynamic loading will work. (My BeBox is in pieces right now, following a nasty disk crash.) You may have to disable dynamic loading to get the thing to compile at all. (use `./Configure` without -d, and say 'no' to 'Build a shared libperl.so'.) Contact Information If you have comments, problem reports, or even patches or bugfixes (gasp!) please email me. 28 Jan 1999 Tom Spindler dogcow@isi.net Update 2002-05-30 The following tests fail on 5.8.0 Perl in BeOS Personal 5.03: t/op/lfs............................FAILED at test 17 t/op/magic..........................FAILED at test 24 ext/Fcntl/t/syslfs..................FAILED at test 17 ext/File/Glob/t/basic...............FAILED at test 3 ext/POSIX/t/sigaction...............FAILED at test 13 ext/POSIX/t/waitpid.................FAILED at test 1 The reasons for the failures are as follows: o The t/op/lfs and ext/Fcntl/t/syslfs failures indicate that the LFS (large file support, files larger than 2 gigabytes) doesn't work from Perl (BeFS itself is well capable of supporting large files). What fails is that trying to position the file pointer past 2 giga- bytes doesn't work right, the position gets truncated to its lower 32 bits. o The op/magic failures look like something funny going on with $0 and $^X that I can't now figure out: none of the generated pathnames are wrong as such, they just seem to accumulate "./" prefixes and infixes in ways that define logic. o The Glob/t/basic indicates a bug in the getpw*() functions: they do not always return the correct user db entries. o The sigaction #13 means that signal mask doesn't get properly restored if sigaction returns early. o The waitpid failure means that after there are no more child processes, waitpid is supposed to start returning -1 (and set errno to ECHILD). In BeOS, it doesn't seem to. Disclaimer: I just installed BeOS Personal Edition 5.0 and the Developer Tools, that is the whole extent of my BeOS expertise, so please don't ask me for further help in BeOS Perl problems. jhi@iki.fi perl v5.8.0 2003-02-18 PERLBEOS(1)
All times are GMT -4. The time now is 03:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy