Click here to Skip to main content
15,891,529 members
Everything / Sockets

Sockets

sockets

Great Reads

by ObiWan_MCC
A C# SMTP server (receiver).
by Florian Rappl
Creating a highly extensible presentation app with multi-user and device integration for tablets.
by _m0n
Connect to PC with no public IP using Node.js app for reverse port forwarding / tunneling
by tonywilk
Example server and client using different protocols over a Websocket (php/js)

Latest Articles

by honey the codewitch
Explore adapting Socket's async model to a task based one and adding some awaitable socket operations to your projects
by Greg Utas
Replacing its erase() function
by Mircea Neacsu
C++ streams for socket communications in Windows
by pdoxtader
A multithreaded server class that accepts multiple connections from a provided client class. Each client can send and receive files and text (byte data) simultaneously along 250 available channels.

All Articles

Sort by Title

Sockets 

5 May 2013 by evanharijanto
hello everyone, I'd like to ask why is this error occurs.I am trying to get a string data from a device. I have make this code and it runs well when I try to obtain data from a local server, but it stated this error when it connects to the device.java.net.PortUnreachableException: ICMP...
13 Aug 2012 by Richard MacCutchan
Any hacker worth their salt could do their own research on a subject like this.
23 May 2010 by ibraaaa
I'm developing an Asynchronous Game Server using .Net Socket Asynchronous Model( BeginAccept/EndAccept...etc.)The problem I'm facing is described like that:When I have only one client connected the server response time is very fast but once a second client connects, the server response...
28 May 2010 by ibraaaa
-disabled Nagle Algorithm i.e. set Socket.NoDelay = true-in WaitForData method, moved call to BeginRecieve befor handling the previously received packet
22 Jul 2014 by nitrous_007
Please help with this problem be patient and read through to the end. I will really appreciate it!!!I am creating 4 sockets on a computer with 4 network adapters and binding each socket to 1 network adapter. Network Adapter 1 is at 192.168.100.10. Socket 1 binds to Network Adapter...
22 Aug 2014 by nitrous_007
Nice article which might answer some of my questionshttp://msdn.microsoft.com/en-us/magazine/cc163648.aspx[^]In my code I am using syrnchronous ReceiveFrom function instead of the asyncronous BeginReceiveFrom. Is there any problem using the syncronous version as I am sending some data and...
28 Aug 2015 by nitrous_007
The solution turned out to be fixing the routes on the Test PC to make sure all the IP's were talking to correct network interfaces.
3 Aug 2010 by ankitpsaraogi
This is the form.cs in my REMOTE SERVERusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.Remoting;using System.Runtime.Remoting.Channels;using...
3 Aug 2010 by William Winner
have you adjusted the firewall on the target machine to allow incoming traffic on that port?It's nothing to do with your code, but everything to do with the machine that you're using to hose the object on.
4 Aug 2010 by ankitpsaraogi
Yes I have even tried turning off the firewall...Are my codes correct???
10 Aug 2010 by John Whitmire
The code you posted shows escape sequences in your strings that will give you unexpected results, but I suspect that was just a posting oversight. If not, start there.You won't get any connection over the Internet with the address you posted since that is a non-routable address that won't...
20 Dec 2012 by pokemonjohn
HiI have a UDP Listener running as a service on a server written in .Net which has been working fine, but now my client is using a VPN connection to the server as well.It seems that the UDP listener is not detecting any traffic from the VPN connectionI've tried binding it to...
7 Jan 2013 by pokemonjohn
I found out it was how a 3rd party was passing through the data to the VPN - once they changed a setting it all worked again !
9 Jan 2020 by ilostmyid2
Hi There's a source (camera) which sends notifications (motion alarms) to port 8085 of a server I've subscribed its IP for it. Maybe in such a negotiation I can't call it 'server', but it's our server which serves some other things. I've written two programs for receiving and echoing current...
6 Feb 2011 by pegaz9
Hi, i am from Poland and i am not fluent English.I am writting M.A thesis. Supervisor want that i programmed protocol communication but i doesnt know how to do it. It protocol should be do/has:- used socket(UDP protocol)- consisted of package, for example: init, bye ping, message,...
6 Feb 2011 by #realJSOP
You picked a programming project for your thesis, and you don't even LIKE programming? Beyond that, writing a thesis involves YOUR OWN research, not ours. research it, LEARN how to do it, and then write your thesis.
6 Feb 2011 by Espen Harlinn
You could do worse than starting out reading this book:http://www.cs.wustl.edu/~schmidt/POSA/POSA2/[^]It will not give you the answer, but it will enable you to understand how these things are usually done. Since you are writing a thesis, I would guess that you will have to understand the...
30 Nov 2013 by agent_kruger
i would like to know the concept of creating your own voice instead of windows default voice in pc.Example code will be appriciated. Thanks In Advance.
30 Nov 2013 by OriginalGriff
If you have "refered many google links" then what do you expect us to tell you that you haven't found? Especially in a little textbox like this?Go back to Google, and look again: it contains a huge amount of information on the subject which will better answer a general question such as this.
30 Nov 2013 by agent_kruger
i would like to know the concept of transferring data between 2 computers over internet.Example code will be appriciated. Thanks In Advance.
30 Nov 2013 by OriginalGriff
If you have "refered many google links" then what do you expect us to tell you that you haven't found? Especially in a little textbox like this?Go back to Google, and look again: it contains a huge amount of information on the subject which will better answer a general question such as this.
9 Jun 2013 by Arsineh Boodaghian
Hi, I have edited my question...Im having problem with this part of program, if ((n = sendto(dccp_sockfd,cmdframe, 18, 0, (struct sockaddr*)&PMU_addr,sizeof(PMU_addr)) == -1)) { perror("sendto");// when I use the program, this error execute at runtime by saying sendto: broken...
6 Jun 2013 by KarstenK
You should search for some working sample code.I guess you mismatch some flags
19 Dec 2013 by Member 10478484
I'm writing an application that has to make a connection on a socket to a set IP and port. During the lifetime of this socket connection, I'm required to listen on a specific port and respond when a message is received on the same port.The application is part of a complex multi threaded...
19 Dec 2013 by CHill60
Without seeing the actual code it's quite difficult to assist. However will this article help Multi-threaded Client/Server Socket Class[^]?
28 Dec 2013 by Albert Holguin
This sort of sounds like you may be accidentally using the same socket on different ports. Check to make sure each one has his own socket and they're not somehow using the same socket identifier. Also, make sure that your listening thread isn't terminating early for one reason or another.As...
13 Jan 2014 by OriginalGriff
It doesn't quite work like that - we are not that kind of site.If you want someone to write your code, you have to pay - I suggest you go to VWorker.com and ask there.But be aware: you get what you pay for. Pay peanuts, get monkeys
4 Mar 2017 by xXxRevolutionxXx
Hello ! I have two programs(created with python 2.7), that exchange data(phrases or/and files) using sockets. What i want, is the connection to be secure, so no one can read or access these data. I tried using encryption algorithms, but that wasn't much practical. So i found that i could use...
4 Mar 2017 by Richard MacCutchan
Quote:I tried to find information through the official python SSL doc, and some stackoverflow articles.It took less than 1 second to find 17.3. ssl — TLS/SSL wrapper for socket objects — Python 2.7.13 documentation[^].
5 Mar 2017 by xXxRevolutionxXx
I found this webpage: bearcave SSL example that gives a full example on how to use SSL... so that you can understand everything... and then transform this knowledge to your own "SSL Connection". I leave it here, hoping that others will find it useful as i did.
27 Oct 2013 by kleymanx90
hi,i have two packet Classes ,1- CommandPacket: class CommandPacket { /** @var CommandPacketHeader */ private $header; private $data;}and 2- CommandPacketHeader :class CommandPacketHeader { /** @var integer Cardinal */ private...
27 Oct 2013 by Richard MacCutchan
You already posted this at http://www.codeproject.com/Messages/4688029/how-can-i-split-an-object-into-chunks-and-send-the.aspx[^]. Please read the guidelines and use one forum only.
2 May 2013 by evanharijanto
Hi all, I'd like to ask a question.I would like to receive a data from an UDP port and display the data as string.here is my trial code, but it doesn't works.it is stated in the error message that it can't bind and also stated socket.bind(native method)I am still don't understand...
2 May 2013 by AlphaDeltaTheta
Well, your code is absolutely correct there is no issues with it.You are encountering a bind exception. Such exceptions occur if the underlying operating system is unable to create an socket at the specified port. It might be for the following reasons:1. The port 53 is already in use. In...
2 May 2013 by AlphaDeltaTheta
Well, your has no issues with it. Except for the thing that the constructor used to create a datagram socket for receiving must not include the ip address. It should be like thisDatagramPacket p = new DatagramPacket(buffer, buffer.length);You are encountering a bind exception. Such...
2 May 2013 by evanharijanto
solved!! thanks everyone!!here is the code I have made after some confusing period.import java.io.IOException;import java.net.DatagramPacket;import java.net.DatagramSocket;import java.net.InetAddress;import java.net.SocketException;public class udp_test{ public static void...
23 Jul 2013 by Ken Chiayuan Chang
main function:#include #include #include "server.h"#include using namespace std;int main(){ Object_server a; Sleep(10000); return 0;}this is server.h:#ifndef SERVER_H_INCLUDED#define SERVER_H_INCLUDED#include...
23 Jul 2013 by Fredrik Bornander
This call;int_flag=_beginthreadex(NULL, 0, Object_server::accept_thread, (void *)this, CREATE_SUSPENDED, &threadID);Creates the accept thread in suspended state, you'll either have to start the thread manually by calling ResumeThread after that or, change the CREATE_SUSPENDED to 0,...
13 Jun 2013 by My_LoVe_IRAN
hii need hear the 192.168.1.1 by client 192.168.1.8 .how can hear ?
13 Jun 2013 by Garth J Lancaster
you dont give any indication of what you want to 'hear' .. I'd start with something like SharpPcap - A Packet Capture Framework for .NET[^] , but it really depends what your requirements are 'g'
31 Jan 2012 by asok00000
I have a idea: The Sene is computer A has a progress P1 which looks like a web browser and Computer B has a progress P2 which doesn't have UI. When P2 is working,it will tell P1 it's IP.And then P1 visit a website but not real,P1 send the HTTP request to P2(like proxy packege).Then P2...
27 Jul 2011 by cschenlu
hello programmers, I've got a problem here. I want to write a program to ban bluetooth's transmission so that to guarantee the security of my files. What should I do? It seems that only to hook the fuction "socket" is not enough,because bluetooth use other protocols except TCP/UDP. Plss...
15 Oct 2010 by Andre Trollip
A simple set of classes to make creating Peer to Peer messaging easy using UDP. Features built-in message concatenation and delivery receipts for reliable transmission.
23 Jun 2020 by Greg Utas
Replacing its erase() function
1 Dec 2010 by Alexeirob
Hi,I'm having a problem with accept function in Windows.It takes 2-4 seconds to accept a socket from another 3rd party application.Here is my code:DWORD dwStart = GetTickCount();AcceptSocket = accept(ListenSocket, NULL, NULL);DWORD dwEnd = GetTickCount();DWORD time = dwEnd -...
1 Dec 2010 by E.F. Nijboer
Have a look at the remarks on accept:The accept function can block the caller until a connection is present if no pending connections are present on the queue, and the socket is marked as blocking. If the socket is marked as nonblocking and no pending connections are present on the queue,...
13 Dec 2013 by Member 10464482
Greetings,I want to send a string from actionscript to java trough a socket.this is my java codeimport java.io.BufferedReader;import java.io.InputStreamReader;import java.net.ServerSocket;import java.net.Socket;public class Main{ public static void main(String[]...
2 Jan 2014 by howletking
the answer's you need to good prepare you data-formatwhen try to close one socket ,flush the stream firstI don't like japanese at all
25 Nov 2014 by ali sedighian
HelloI want To See Code Of Advanced Ip Scanner Or A Project(If Not One,Several Projects) Like It That I Can Do These Things:1.Find Out Manufacturer Of An IP Device.2.Operating System Of An IP Device.3.Can Access To Share Folder Of An IP Device.4.If It Has ftp I can Access...
25 Dec 2016 by Member 12920604
I am very new to programming so forgive me if my question may seem obvious. I am interested in learning more about networking, though I never got a chance to take a class in it. It was suggested to me that I will learn a great deal about packets and packet generation by writing my own program to...
24 Dec 2016 by Richard MacCutchan
Java is not the best language choice for this type of application, you would be better studying C or C++. You also need a thorough understanding of the API available within the OS that you plan to work with.
27 Dec 2016 by Srivats P
While it is good to understand networking by generating your own packets, you don't need to write a program to do that. My advice is to generate packets using Ostinato - the process of generating packets as a user in Ostinato is low level enough for you to understanding the networking packets,...
17 Apr 2011 by Shajeel
I am looking an freeware alternate to http://www.socketworkbench.com/[^]. Can any one please point out?Regards
17 Apr 2011 by Debojyoti Majumder
HTTPWatch might be helpful for you...check this link:http://www.httpwatch.com/[^]
21 Aug 2015 by BVandenbon
There's a kickstarter project: TCP/IP bouncer. It's a java application to analyse TCP/IP communication.It is based on the principles of socket workbench, but it goes way beyond that. It uses draggable building blocks, which allows you to also simulate communication.
29 Jan 2013 by ali_heidari_
hi....i want to make a small app for connecting to a chat application and get some data! i want know is a generl way to connect with any server and get data or any server must provide some ways to let us connect to it! and if a server didnt do that we cant connect to it?i know how i can...
29 Jan 2013 by Marco Bertschi
This tutorial[^] helped me.
30 Jan 2013 by Sergey Alexandrovich Kryukov
First of all, when you talking about "server", it should be something which you develop yourself, because you will need to have some custom application-layer protocol:http://en.wikipedia.org/wiki/Application_layer[^].More exactly, a service. The term "server" is more often used in a narrow...
9 Nov 2014 by akshaya srinivasan
I have created an one to one chat application using HTTP connection (In this method each and everytime you want to send message, you have to call the webservice and for receive message, you continously need to call the webservice using Timer).Now I want to implement group chat app.Can some one...
9 Nov 2014 by Afzaal Ahmad Zeeshan
First thing that I forced me to answer this question was, you said "continously need to call the webservice using Timer". Why? It is not a good user experience for most of the Android users. I am having an Android mobile phone that has only 128mb Ram and a single core processor and I just don't...
13 May 2013 by Faheem Ahmad
Hey Guyz,Can anyone guide me how to achieve multi player behaviour in my simple android game.I have a simple game based on client and server model but now i want to give it a touch like real time multi-player in a module, where some action performed by a single users will be visible to other...
10 Mar 2012 by kaqa90
I would like to send a socket of binary numbers to a program in PC, I'm working in android 2.3 platform on Windows 7. When I run the program in android emulator, its runs perfectly, but when I press the button which is create a socket object, the app will stop working. Here is the code the cause...
10 Mar 2012 by Sergey Alexandrovich Kryukov
Please see my comment to the question.One important note: You are doing one bad thing: prevent all exceptions from the event handler from further propagation. Exceptions are not designed for catching them here and there: they are much more powerful then you might thing. Basically, in most...
12 Mar 2012 by Darren_vms
Personally I would declare the socket private an nullprivate Socket socket = null ;that should fix up the problem
9 Feb 2019 by zvx
An introduction to writing IOCP network servers
14 Nov 2015 by Awesh Vishwakarma
Hello Everyone!I have following TCP Server Socket code that will receive messages from the port 25000 and sends the response on port 25001, This is working fine. How i can receive the response in Socket Client?Please help me with a code snippet.using System;using...
14 Nov 2015 by Harish Singh
private void ReadResponse() { IPEndPoint ep = new IPEndPoint(IPAddress.Any, 25001); EndPoint epp = (EndPoint)ep; int count = 0; byte[] recBuf = new byte[1024]; int rec = requestSocket.ReceiveFrom(buffer, ref epp); ...
11 Apr 2013 by theliberator
Hello,I'm having an odd problem when trying to connect to my async tcpsocket via telnet.Here's my code:// State object for reading client data asynchronously public class StateObject { // Client socket. public Socket workSocket = null; // Size of...
4 May 2014 by Deepthi Vonteru V
Can any one please help me understand , when my scoket at client end is not sending the response back to server socket . Here is the scenario1.Server send request2.Client receives the request3.After receiving request , Client starts some process and runs for more than 1 hr4.After...
5 Dec 2011 by Lee Trueman
Hi all,just thought id ask you guys for your thoughts on something i'm looking into doing.Basically looking to develop a Server that will accept TCP connections. The clients will not be connected constantly, i.e the clients open connection, send data to the server, the server will send...
5 Dec 2011 by Sergey Alexandrovich Kryukov
I think everyone should prefer synchronous API relying on your threads instead. For example, a network service typically need just tow thread to work with sockets, let me call them "listening thread" and "application protocol thread". Usually the best TCP API is TcpListener/TcpClient. The...
20 Sep 2010 by juanporto
Hi, I have the following Sockets server, which works asynchronously andaccepts multiple clients connected at once. I got it from the microsoftwebsite.I made slight modifications in the example code, in the configuration ofthe IPAddress and port.1. using System; 2. using...
20 Sep 2010 by Abhinav S
No dont use a loop. Creating a polling sort of a maechanism using a timer.
10 Feb 2011 by Espen Harlinn
See the lines marked with "new" - You're pretty close to a working piece of code already.124. Send(handler, content); new. // All data received. Get next message. new. handler.BeginReceive(state.buffer,StateObject.BufferSize, new. ...
3 Jun 2011 by tarunkashyap p
hi, I from electrical engineering and i know very little about programming.can you help me with developing an application for single server multiple client(few hundreds) communication(TCP/IP protocol), which has to be asynchronous and server capable of replying to the data requested by the...
3 Jun 2011 by Tarakeshwar Reddy
What have you tried till now? Try to apply what ever knowledge you have gained from reading the articles you mentioned. Code project has a lot of articles on the topics you have mentioned. Give it a try and ask specific questions, people would be more than willing to help when they see your effort.
3 Jun 2011 by tarunkashyap p
Thank you very much for responding to my post. I have written a code base on some articles and i am able to connect to the server from multiple clients. My client application is a windows form application and server is a console application. After connecting to few clients and try to send...
6 Jun 2011 by tarunkashyap p
Server program (Console application)using System;using System.Threading;using System.Net.Sockets;using System.Text;using System.Net;using System.IO;namespace ConsoleApplication{ class Program { public Socket socketStream; private BinaryWriter...
6 Jun 2011 by Enill
Hi, I am planning to create an asynchronous sockets client-server architecture, however I have some questions to ask so it can clarify some things for me. I have build multiples REST architecture in the past but its my first time with sockets.So lets say for example that I would like to...
6 Jun 2011 by Sergey Alexandrovich Kryukov
No, how? You can have separate IO ports for different purposes. You may use one port for "quick" message exchange, one for for "slow" file transfers. Or wait :-).—SA
16 Apr 2013 by Aayman Khalid
am trying to make an asynchronous udp chat application currently havung only one client and server.the problem is that when I run my server it displays a lot of redundant data and afterward whwn some text is typed displays the error"Error sending the file! \n"... Could someone please look at the...
28 Apr 2014 by Sergey Zubarev
AsynchronousSocketChannel concurrent writes
2 Mar 2015 by syed shanu
Open protocol using C# socket programming for NutRunner
27 Aug 2011 by Member 7766180
I'm having a problem with this segment of my code, It gives me this error.Unhandled exception at 0x5518c1a8 (msvcr100d.dll) in Eyeball.exe: 0xC0000005: Access violation reading location 0x525c3a43.This is the code...if ((argc>=4) && (strcmp(argv[3], "m")==0)) more=1;result =...
27 Aug 2011 by Simon Bang Terkildsen
the string you pass to atoi is not null terminatedyou have less than 3 arguments. You haven't ensured that you have 3 arguments thus result = atoi(argv[2]); might fail.Stepping through your code line by line, with the debugger, will allow you to find the line that fails and it should be...
13 May 2012 by Zainy95
Hey there! I'm looking for a c# application which allow us to do audio video chat on local network. I've tried google and tried each project available on this site but some of them have errors while compiling while rest of them don't work as they supposed to work. I want to accomplish this task...
13 May 2012 by Jackie00100
Hi if you're looking for places as a programmier look at this: [^] i used that for my own IM-Chat for Call and video chat.if you're looking for softwares this isn't really a forum to ask in, but why not use skype, or if you need something controlled then ventrilo or teamspeak? i know all of...
9 Jul 2014 by Member 10935983
Is there is any possibility to automate login into virtual desktop through any of programming languages ( either through sockets or others ) need to automate login in to vdi and access application of it in local
27 Apr 2013 by Cosmo Gong
Hi, I am writing a client/server program using C# winsock classes. The multi-threaded server (1 thread per client connection) sends small chunks of data to clients. For performance reason I try to use BeginSend instead of Send. It seems to be working fine. The only problem I am encountering...
10 Aug 2023 by pavan idirect
I am trying to come up with a design to efficiently send a tree data structure (each node can have more than 2 branches) to a socket/different process etc. There seems to be a cap on how much data can be sent in one message (1500 Bytes). The tree...
20 Dec 2015 by venkat28vk
Hi,I have developed a server and client code using tcp/ip protocol, which enables the client to send data to server and the same data is received from server to client. I would like to know how to keep the client open all the time, same like as server. I should not keep executing the...
18 Dec 2015 by Garth J Lancaster
surely that depends on YOU - what you you want/need to achieve in the client ? (we dont know your requirements because you havnt stated any)instead of str_echo(ls); you could do for (; ; ){ str_echo(ls); sleep(60 * 1000); // for example to sleep 1 minute between loops...
12 Apr 2013 by ayesha hassan
I am working on udp server/client application. I want my single server to handle 40 clients at a time. For this, I want to create 40 dedicated threads, each dedicated for one single client. Since there are 40 threads one for each client, I want to create 40 dedicated sockets as well. But the...
12 Apr 2013 by jsolutions_uk
If you want a multi client server (who wouldn't?) you shouldn't need to listen on 40 different sockets, but rather a single socket. On recieving a connection, spawn a thread to handle the connection... or a process if you want to go old school :)In fact here's a good example Beginning...
12 Apr 2013 by Manfred Rudolf Bihy
You're trying this the wrong way round. The server should have one socket (IP-adress and port) on which it accepts connections and then it will spawn a separate thread for each client that connects. If you were to do it your way you'd need either 40 IP adresses and listening on one designated...
10 Apr 2013 by Parwarrior7
Hello everyone,This is only my second instance at working with Sockets, I apologize in advance as my knowledge on the matter is clearly limited. Here's what I'm stuck on:I have a Dialog box A. Dialog A has a button which opens Dialog Box B.It contains two private variables: ...
10 Apr 2013 by skydger
You could achieve this using different techniques.First is to use select() model.http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx[^]Second is to use event model using functions such as WSAEventSelect, WSAWaitForMultipleEvents...
10 Apr 2013 by michaelmel
I am guessing you are testing your FPGA using a little windows test programIt is almost always a bad idea to call socket functions from the application's main thread, or event/message handlers (such as OnButton1). The main reason (and there are others) is that socket functions will commonly...
12 May 2013 by ayesha hassan
I had been working on a Server Client aplication where Server is going to service(sendto + receivefrom)'x' number of Clients at a time. For this purpose, I have created 'x' number of threads on Server side so that each thread is dadicated to one single client. Inside each thread there is a...