Programming :: Chat Socket Between Client And Server

Mar 17, 2011

I want to built a Chat Program (based on Socket connection) between client and server. I use the GTK+ &GLADE graphic tool. Can you send me the code for this program or any material to learn. Also, I want to know how to show the input to text view (in GTK+&Glade).

View 3 Replies


ADVERTISEMENT

Programming :: Socket And Timer Programming - Server Doesn't Execute Any Msg Which Client Sent

May 16, 2011

i have a server program which accept multiple client connection and am using polling. like every 2 secs it will look to client whether any data is received after it binded. i have used setitimer but there is runtime error i got.. the server accept all client connection but doesn't execute any msg which client sent.

#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netdb.h>
#include<unistd.h>
#include<pthread.h>
#include<string.h>
[Code]....

View 1 Replies View Related

Programming :: Socket Programming - Detect Whether A Client Socket Is Closed / Active?

Mar 8, 2011

iam just trying to connect to server which accepts one client and server will read(blocking operation) infinitely, but After closing the client socket the server "read operation" is returning zero and "errno variable(in errno.h)" value is also zero. how can i detect whether a client socket is closed/active..?

client.c
Serv_Addr.sin_family = AF_INET;
Serv_Addr.sin_addr.s_addr = inet_addr("127.0.0.1");
Serv_Addr.sin_port = htons(26553);
if( 0 > connect (Serv_Fds,&Serv_Addr,sizeof(Serv_Addr)) )
{
perror("connect");
return 0;
[Code]....

View 3 Replies View Related

Programming :: How Could Server Detect Closed Client Socket Using TCP And C++

Aug 6, 2010

Reading some examples on net and copying some codes I was able to build a (frankstein) server that accept connection from one client and receive and send messages to it. The big problem that shows up is that I don't know when client disconnects from my server.

I've been looking for a solution, but no success. I'd read about SO_KEEPALIVE option (which could solve my problem), but I don't know how to use it (how to check the value of it).

I can't use ping because the server (machine) could be running, but not the client (software).

Anyone knows a good tutorial or how to (for beginners like me xD) of TcpIp sockets using c/c++ and how to detect when a client disconnect?

I don't know sockets very well.

View 6 Replies View Related

Programming :: Timer In Socket Programming - Wait For X Sec After Read() And Then Disconnect The Client Connection

Mar 8, 2011

I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.

View 3 Replies View Related

Programming :: Socket Programming Using Php - Swap A Client Ip And Port?

Mar 28, 2011

Is it possible to swap a client ip and port ? This is what I am trying to do. Let say you have Comp1 and Comp2 And you have Server between them. My goal is to get Comp1 and Comp2 know each others IP So Comp1 connects to server And server stores comp1's IP In a text file or other place And Comp2 connect to server And server also stores his info And then both comp1 and comp2 dowload the tex file And use the info on it.

View 9 Replies View Related

Programming :: Tcp Client Socket : Get Own Port Number?

Oct 1, 2010

I am working with simple tcp client to establish connection to sockaddr_in servAddress and send data segment:

...
connect(sockfd,&servAddr,sizeof(servAddr)) < 0)
send(sockfd, pkt, pktLen, 0);
close(sockfd);
...

Elementary... Here's the tricky part: next i have to handle user level ack the server is sending to "client"... To do that i have to open server socket on the same port number the system assigned to my client socket before. How can i get it ( in user level code)?

View 2 Replies View Related

Programming :: Remote Client Mac Address On Socket Descriptor?

Dec 14, 2010

I want to get the connected client MAC Address after accept() call. I can get the IP address of the client but i don't know how to get the client MAC Address in my this programme. Here I am Posting my Code.

#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>

[code]....

View 10 Replies View Related

Programming :: Fetch The Remote Client Mac Address On Socket Descriptor?

Dec 14, 2010

I have written one simple code which is posted here. i want to fetch the Mac Address on socket descriptor which is returned after accept () call.

Code:-

#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>

[code].....

View 1 Replies View Related

General :: One Server Many Client Chat Program Using Sockets

Aug 1, 2011

I am trying to write a chat program with sockets as part of my project. I made a socket server, using fork ,I tried to connect it with different clients.Each client will send messages to others through server.So server has a shared memory storing every clients username and client id. But the problem facing is first client is able to sent messages to every other client formed after that.But second client onwards it is not able to sent message to previously connected ones. Server is not able to write on those client id's.

View 4 Replies View Related

Programming :: Socket Programming - Connect To An IRC Server In A C

Mar 16, 2010

I am looking to be able to connect to an IRC server in a C program. I have followed some instructions from an old book I have however it doesn't seem to be working. I've tried connecting to localhost on my ssh port and it still doesn't want to work. This is what I have so far as a piece of skeleton test code:

Code:
#include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<unistd.h>
#include<netinet/in.h>
#include<arpa/inet.h>
[Code]....

View 1 Replies View Related

General :: Socket Programming - Feed Some Words One By One To The Socket

Jul 6, 2010

i'm writing a simple program of client socket program. Here below is the code sample which i'm writing...

Code:
//tcp_client.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include<string.h>
#include<stdlib.h>
[Code].....

the above code works fine.if we copmile and run ./a.exe 192.xx.xx.xxx 1111 and press enter it works fine..everytime it asks "Please enter the message: " and if give that will be displayed in server. but my problem is i dont want to print everytime "Please enter the message: " i just want to feed some words one by one to the socket.

View 4 Replies View Related

Programming :: Setsockopt : Socket Operation On Non-socket Getting Error?

Mar 30, 2009

im getting that error in my code for some reason. I compiled my code, and when i try to run this server it throws me an error on my call to setsocketopt(). The only way it can reach that part of my loop is if it succeeds when it calls sock() so I dont understand why the error says its an operation on a non-socket. Im just trying to set up a server to pass messages from a client to it a viceversa. Here is the code:

Code:
int main()
{
int socket_fd, new_socket_fd, k;
struct addrinfo hints, *server_info, *p;
struct sockaddr_storage peer_address;
code....

View 7 Replies View Related

Programming :: Server Socket Assigned By Children Processes ?

Aug 27, 2010

I am currently programming a suite of daemons in c++ on CentOS 64. More or less all those daemons are SOAP servers, with the SOAP part handled by gSOAP.

One of the daemons is a monitor sitting on a certain server and more or less just checking if the other daemons are up and running - but also offering a SOAP interface to get the 'current situation' on the machine.

Whenever the detected situation does not correspond to the defined (i.E. a process which should be is not running) it is started up.

This part, I implemented via a system() call that starts the other process.

I was a little confused when lately often this monitoring process would not start because it could not bind its server port - the one the SOAP server is listening on.

And confusion got bigger when netstat told me that the port is assigned to one of the processes that were before started by the monitor..?

Even better: if I then kill the process of which netstat tells me it holds the port, the next netstat shows the next monitor-started process as the one listening on the port..

Only if I kill all the processes that were started by the monitor, the port is released and I am able to launch the monitor again.

Now I wonder: why does this port get 'reassigned' to the children - and most of all: how can I prevent this from happening?

View 6 Replies View Related

Programming :: Socket C++ / Send And Receive Messages In Server?

Jan 2, 2009

I'm trying implement a small server for a university work, my server is creating, binding and listening but it don't accept any connection, these are the files I'm using in server:

Code:

// Definition of the Socket class
#ifndef SOCKET_H
#define SOCKET_H
#include <sys/types.h>
code....

I've made a client just for test it, but no ones run well, the server is always returning -1 when accept is called!!

What should I do to send and receive messages in this server??

View 3 Replies View Related

Server :: Socket Connections / Socket And TCP Connection For Connecting To An External System?

Dec 7, 2010

Anyone knows the difference between a socket and TCP connection for connecting to an external system?

View 1 Replies View Related

Programming :: Socket Server Using Pthread Doesn't Wait For Accept() Properly?

Apr 19, 2010

I'm building a simple(?) socket server using threads to serve up a few requests. The spec is such that I have to listen to three ports at once, so I decided to use pthread to create three separate threads that would wait for connections, then spawn new threads to handle them.

The problem is that when I do this, for some reason the program never enters the wait loop and instead terminates (All three threads did get created since the messages get printed properly.) It gets to the line which prints "???", but not the line after the accept() call.I don't see an open port when I check for one either so I'm 99% sure they're terminating.Basically I have a main() method which has three calls to pthread_create, which should result in three threads being run that all wait for connections (listenOnPort). After each thread creation I print some info to make sure it's actually being created.

By the way, when I just run listenOnPortwithout threading, the server appears to enter the loop correctly and seems to be waiting for requests. It's only when I run the functions as threads that the problem seems to happen.The source is attached below. Any help will be appreciated. Much of the code is borrowed from a website (I can't post it because I am new here.) You need not worry about the handler_ methods because those are just methods that are run by the threads themselves.

Also--the original source was in C and I changed it to C++. Should I just use C?
server.h Code: /*
* server.h

[code]....

View 1 Replies View Related

Ubuntu :: How To Install Pidgin Chat Client

Apr 4, 2010

how can i install pidgin chat client on ubuntu

View 1 Replies View Related

OpenSUSE :: Empathy Chat Client - Got Some Errors That Need Addressing!?

Sep 9, 2010

I've got a problem occurring with my openSUSE 11.3 // GNOME Empathy Chat Client. When I try to connect to my Facebook account, my client tells me that I have a Network Error. Last time I used the client at home, it worked perfectly fine, but when I'm at work it doesn't.

Now, you guys may say that my work's network may have ports blocked, or the firewall is blocking its use in some way, but I find that hard to believe. My reasoning? I am able to connect to my Facebook account thru Empathy at work on my previous Ubuntu 10.04 system with no problems. I have also been connected to the same chat accounts this whole week on my openSUSE 11.3 // KDE 4.4 Kopete chat client.My Empathy connects to my Skype with no problem also. So, do any of you have any ideas that could possibly solve my issue? I love being connected to my Facebook chat at work because I don't see anyone nearly as often, and it's a great way for me to keep in touch with them.

View 2 Replies View Related

General :: Switch Default Chat Client In Ubuntu 10.04?

Jul 19, 2010

I have been using ubuntu for almost a week. and i am impressed on how it seems to fulfills most of my computer needs better than windows. when i click the new message indicator (the envelope), and click chat, by default it opens empathy. personally i prefer pidgin, and i would like to make it open pidgin instead of empathy when i press chat. it currently shows pidgin in the list anyway but i want it to appear as chat.

View 1 Replies View Related

Ubuntu :: Broke Chat Client - Reset Any Empathy Settings?

May 6, 2010

1. My status selection has disappeared from the contacts menu (See #1 on picture). This lead me to a desperate search on how to delete/reset any config files for empathy. Tried to complete-remove and then reinstall it. This though didn't remove the settings or repair the glitch but instead led me to my second problem.

2. After reinstallation, this redundant little notification icon appeared (See #2 on picture). Cute... now how do i get rid of it? how to reset any empathy settings (problem one would at least solve then... I would presumably think?

View 1 Replies View Related

Ubuntu :: Loopback Sound To Wine Chat Client 'stereomix'

May 31, 2010

I'v spent 3 days in google hell I'v learned alot but still cannot find a solution to my problem. I'm trying to use for a lack of terms 'Stereo Mix' I have Paltalk Messenger installed under Wine 1.01 everything works fine, including my mic I want to loop my sound from rhythmbox and play it in IM/Chats One of the Best resources I have found was Ubuntu 9.04 Sound Solutions Forum Topic

Every package is installed from the link above and I am able to record from rhythmbox using Gnome Sound Recorder but I am unable to send the sound to Paltalk. I'v also ran into a few resources that talk about creating a virtual sound card and then looping the sound back but I was unable to find a good clean howto I'm using Ubuntu 9.04 32Bit I upgraded all the pulse audio tools and now when I key on mic I can click my recording tab see my wine app and switch the stream over

View 2 Replies View Related

Ubuntu Networking :: Unable To Check Email & Use Chat Client?

Aug 16, 2010

Just installed Ubuntu 10.04 on my Acer laptop last night. I wasn't able to surf the net at first but after searching these forums, managed to get it right (changed setting in firefox). I was able to use update manager and the software program ok (downloading and installing). I am using a adsl via wifi. Networked pcs and my NAS/samba work fine
My current problem is that while I can surf the net and download updates etc, I can't seem to get email and chat working, it just gives a timeout error for some reason.

View 5 Replies View Related

Ubuntu :: Chat / IM Client That Has Email-actions And Auto-login (Trillian-like)?

Jun 30, 2011

I've been using Trillian under Windoz, for one reason only - the email message-handling is amazing. Here are the features that impressed me the most with Trillian:

Check multiple email accounts + notifications (but that exists in many other clients)
Preview subject line + message body teaser (this exists to some extent in Adium)
Preview the above not only upon email-check, but in the client window itself or as tooltips when hovering over email-account name Email ACTIONS - right-clicking on individual messages, can perform common tasks (archive, delete, view, mark as read).

The actions available change for different protocols AUTO LOGIN-when double-clicking the account a browser window will open and automatically log me into the account That last feature is the most important one - at the moment, Pidgin/Adium/Empathy just send me to the email-account's homepage. I have (too) many email accounts, and having to enter login details to each is a pain. With Trillian, I could d-click an account, see my inbox, logout and then d-click another account - and be logged into that one... easy peasy.

Now, this is not a commercial for Trillian... really not. I just haven't found any other client that can do these things, nor have I found plugins for Empathy/Pidgin that enable this. I've been using Pidgin for now, cos it doesn't give any trouble with Skype integration (already tried the skype4empathyandpidgin, didn't work out) and has nice (not amazing) integration to the messaging menu.

View 3 Replies View Related

Programming :: Server With 2 Threads Per Client?

Nov 25, 2010

In all the examples I have found the server accepts the client's conection, proccess the data received and close the socket. In an very schematic way it would be something like:

Code:

client_thread{
select to see if there is data to read from socket fd
if there is something to read{

[code]....

Should I use mutexs or semaphores to block the socket fd before read and write or it is not necesary?

View 4 Replies View Related

Programming :: Encryption From C Client To Php Server?

Jan 12, 2010

I looking for an algoritm to encrypt some data sent from a c program(client) to a php server(can be in perl or cgi-bin) over the internet. How should i send it in c? Some http call? Or it can be in via a perl script. Then i need some basic algoritm to encrypt it. Any ideas. How do i save the key in the c program? Just something basic so its not clear text. This is not for a bank or visacards etc

View 2 Replies View Related

Programming :: Creating 2 Sockets In Client / Server?

Jun 9, 2010

I have a problem creating my second socket in client file. the program was running well but when I try to add another socket to connect to the same server, I got a problem connecting to the first socket! it doesn't make sense. the original code was:

sockfd[i] = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd[i] < 0) error("(MAIN) - Error openning socket 1");
port_num[i] = portno;
bzero((char*) &serv_addr[i], sizeof(serv_addr[i]));

[Code].....

View 1 Replies View Related

Programming :: Connect A Client To A Server In Windwos?

Mar 25, 2010

I am getting this error when i try to connect a client to a server in windwos ,anybody knows why ?

View 3 Replies View Related

Programming :: Design An Audio Chat Programming In Ubuntu

Apr 8, 2010

I want to design an audio chat programming in Ubuntu.So how shall I proceed? Any help on this please?I am complete novice in this topic. Currently my aim is to capture audio from microphone.

View 1 Replies View Related

Programming :: Closing Multiple Client Sockets In Server ?

Nov 30, 2010

I have written a server application which has select for both incoming new client connection requests and incoming data from client. I am able to process incoming connection requests and client data.

For example, server has 8 clients connected to it. If client 3 disconnects from server, how will server come to know this client has disconnected and to close its client socket fd gracefully? Does server's select get data on that client socket fd as 'close' data or any error code in recv() function that notifies server to close this client socket fd? Also if client disconnects abruptly without sending close request to server, how should server handle this? Does server get "EPIPE" error?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved