Sponsored Content
Full Discussion: Client socket
Top Forums Programming Client socket Post 302374973 by uvrakesh on Thursday 26th of November 2009 05:08:00 AM
Old 11-26-2009
Client socket

its seems that the cout is called every time, if the connection is established/not estatblished,

please correct me, if i wrongly understood the problem
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

client app not letting go of socket

Ok here's the situation We have an application that our users log into over the network to one of our unix boxes (Solaris 8). I had this situation occur the other day where an user claimed that he totally shutdown the app because it froze up and wasn't able to log back in. I performed a... (1 Reply)
Discussion started by: fusion99
1 Replies

2. Programming

client socket read returns 0 bytes

Hi I have apeculiar problem with sockets. I have a shared object for my client program. when I send a request to the server, it is suppose to process and sends back the result string to the client. For the first request, it is working fine i.e. client sends the req. and gets the... (1 Reply)
Discussion started by: axes
1 Replies

3. Programming

UDP socket - can both client and server recv and send

Hi, Am very new to socket programming. When we use UDP sockets to communicate between two processess, will both the client/server socket be able to send/recv ? meaning can sendto()/ recvfrom() be used on both server and client? It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies

4. UNIX for Dummies Questions & Answers

socket programming : client server IPC

I'm new to socket programming. Have a basic doubt. I have a structure(global) at the server side. I have two different client connecting to the server. Will the changes made by one client on the structure be visible to the other client when it accesses the same client? I'm creating a STREAM... (3 Replies)
Discussion started by: abc.working
3 Replies

5. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

6. Programming

Client/Server Socket Application - Preventing Client from quitting on server crash

Problem - Linux Client/Server Socket Application: Preventing Client from quitting on server crash Hi, I am writing a Linux socket Server and Client using TCP protocol on Ubuntu 9.04 x64. I am having problem trying to implement a scenario where the client should keep running even when the... (2 Replies)
Discussion started by: varun.nagpaal
2 Replies

7. Programming

how can I send and receive data in client server socket programing

char name; printf ("Welcome to the server \n"); printf ("Enter user name: \n"); scanf ("%c", &name); how can client send name to server:what should be the code? int send ( int sid , const char ∗buffer Ptr , int len , int f l a g ) how can client receive ack from... (1 Reply)
Discussion started by: saiful_911
1 Replies

8. Programming

socket programing in client server

hei, i want to enter name and read it by client server socket program after checking name validity put the password and check.if ok than server clirnt say correct other wise incorrect. below my code: char name; printf ("Welcome to the server \n"); printf ("Enter user name: \n"); scanf... (1 Reply)
Discussion started by: saiful_911
1 Replies

9. Programming

C Socket Client/Server Fork Loop

Hello people. I'm trying to do something like a search engine. Server runs in the background by using ./server & which has data from a textfile stored in an array. Client then runs by using ./client It will then prompt "Search for:" For example, if I searched for Products called Instant... (0 Replies)
Discussion started by: andylbh
0 Replies

10. Programming

Socket dual client/server Linux

I'm trying to make a "dual/server client" (ipv4,ipv6) with sockets in linux but i don't know how to join both codes. I have a dual client ipv4 and ipv6, but i have problems with the server if you notice the only difference between them it's the AF_INET (pf_inet ipv4, and if_inet6 ipv6) and the port... (3 Replies)
Discussion started by: godna
3 Replies
FBB::ClientSocket(3bobcat)					   Client Socket					FBB::ClientSocket(3bobcat)

NAME
FBB::ClientSocket - Client Socket connecting to a Server in the Internet SYNOPSIS
#include <bobcat/clientsocket> Linking option: -lbobcat DESCRIPTION
An FBB::ClientSocket may be constructed to connect to some server process in the internet. The socket made available by the FBB:ClientSocket may be used to initialize a std::istream and/or std::ostream. The std::istream is used to read information from the server process to which the FBB::ClientSocket connects, The std::ostream is used to send information to the server process to which the FBB::ClientSocket connects. Since a socket may be considered a file descriptor the avaiable FBB::IFdStream, FBB::IFdStreamBuf, FBB::OFd- Stream, and FBB::OFdStreamBuf classes may be used profitably here. Note that having available a socket does not mean that this defines the communication protocol. It is (still) the responsibility of the programmer to comply with an existing protocol or to implement a tai- lor-made protocol. The latter situation implies that the sequence of input- and output operations is defined by the programmer. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
FBB::SocketBase CONSTRUCTOR
o ClientSocket(std::string const &host, uint16_t port): This constructor initializes an FBB::ClientSocket object, preparing it for a connection to the specified port at the given host. An FBB::Errno is thrown if the socket could not be constructed. The construction of the socket does not mean that a connection has actually been established. In order to connect to the server, the member connect() (see below) should be used. The copy constructor is not available. MEMBER FUNCTIONS
All members of FBB::SocketBase (and thus of FBB::InetAddress) are available, as FBB::ClientSocket inherits from these classes. o int connect(): This member returns a socket that can be used to communicate with the server process. An FBB::Errno exception is thrown if the con- nection could not be established or if the SocketBase base class could not properly be constructed. EXAMPLE
See also the serversocket(3bobcat) example. #include <iostream> #include <bobcat/clientsocket> #include <bobcat/ifdstream> #include <bobcat/ofdstream> #include <bobcat/a2x> using namespace std; using namespace FBB; int main(int argc, char **argv) try { if (argc == 1) { cerr << "Provide servername and port number "; return 1; } size_t port = A2x(argv[2]); ClientSocket client(argv[1], port); int fd = client.connect(); string line; cout << "Connecting to socket " << fd << endl << "address = " << client.dottedDecimalAddress() << ", " << endl << "communication through port " << client.port() << endl; IFdStream in(fd); // stream to read from OFdStream out(fd); // stream to write to while (true) { // Ask for a textline, stop if cout << "? "; // empty / none if (!getline(cin, line) || line.length() == 0) return 0; cout << "Line read: " << line << endl; // Return the line to the server out << line.c_str() << endl; cout << "wrote line "; getline(in, line); // Wait for a reply from the server cout << "Answer: " << line << endl; } return 0; } catch (Errno const &err) { cerr << err.what() << " " << "Can't connect to " << argv[1] << ", port " << argv[2] << endl; return 1; } FILES
bobcat/clientsocket - defines the class interface SEE ALSO
bobcat(7), ifdstream(3bobcat), ifdstreambuf(3bobcat), inetaddress(3bobcat), localclientsocket(3bobcat), ofdstream(3bobcat), ofdstream(3bob- cat), serversocket(3bobcat), socketbase(3bobcat) BUGS
None Reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::ClientSocket(3bobcat)
All times are GMT -4. The time now is 10:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy