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 Updated

Sockets 

10 Jun 2010 by #realJSOP
Using google ("c# send binary file with sockets"), I found this:http://socketprogramming.blogspot.com/2008/11/split-and-assemble-large-file-around.html[^]
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.
18 Feb 2011 by #realJSOP
Really? Evaluate the requirements, decide on your supported platform, and choose the appropriate language/framework. Analisys part of learning how to be a programmer.
18 Aug 2016 by 09andy
Hi Friends,Currently i am facing problem with socket programming in WCF services for chat application. I have done lot's of R&D on it but not getting successes. So please it is my humble request that if any one have any demo or links related socket programming in WCf services for chat...
30 Apr 2014 by 123456789igor
Hello, i try to write a simple asynchronous client/server apps. I know how do it using callback, but i want to invistigate how write client+server using await/async and c# 5.0. Please, help me. It should be simple. Only connect and transfer some bytes.I know that this can be done using...
1 May 2014 by 123456789igor
Connect success. But how to send bytes, i don't knowprivate readonly Socket _server; public ServerSocket(IPAddress ipAddress, int port) { _server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _server.Bind(new...
1 May 2014 by 123456789igor
now server can send to client array of byte. But client recieved only 1 iteration. How i can do, that if client connected then it always recieve information from server?Server:public ServerSocket(IPAddress ipAddress, int port) { _server = new...
21 Jul 2011 by 2irfanshaikh
I think this link will help you...Connect to a web service through a Proxy Server[^]
5 Jul 2015 by 4L4K1
I can send and receive data between two formapp.using System;using System.Net.Sockets;using System.Text;using System.Windows.Forms;namespace Client{ public partial class Form1 : Form { public Form1() { InitializeComponent(); ...
20 Apr 2010 by @Intersect☺™
See this below link, this will assists you surely to serve your purpose Single Server With Multiple Clients : a Simple C++ Implementation[^]
24 Feb 2015 by _Asif_
As per the code it seems like IP address and port is stored in a configruation file named IP_CONFIG.txt. In order to correctly use IP_CS and PORT_CS variables you need to correctly define these settings in the configuration file.You can get a good understanding by stepping into the code in...
8 Jul 2017 by _m0n
Connect to PC with no public IP using Node.js app for reverse port forwarding / tunneling
25 Aug 2010 by _rubinho_
I'm writing some code in C# for the first time which requires talking to a network attached device using HTTP. Unfortunately the device is broken and so I cannot use the HttpWebRequest/HttpWebResponse classes, so I'm having to do it myself with TcpClient and NetworkStream. I've got the...
25 Aug 2010 by _rubinho_
Thanks for your answer. I am sure that the incoming message is smaller than the buffer size. I have also tried the approach which is outlined on MSDN and it did not help me. This is what I meant by "looping on netStream.DataAvailable and appending any further data" in my question. What I...
18 May 2014 by A wo
I want to send the pictures from my desktop which I get them by a timer. the client version receives the first picture and doesn't get another picture from timer of server version.this is the server version code:using System.Net;using System.IO;using System.Net.Sockets;Graphics...
12 Jul 2012 by a_daish
Hi All,Wondered if you could help.Putting together a Twitter desktop client together in Visual Studio 2010 using Visual Basic for a project. The Twitter client works a charm but I'm trying to figure out how to receive socket messages from third party applications. It needs to be able to...
14 Apr 2013 by Aayman Khalid
Currently I am working on a single server,single client udp chat application. Initially I used blocking sockets which is the default condition. Now I want to convert the socket into non-blocking so that communication between client and server could be done without the obstacle of turns... I've...
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...
17 Apr 2013 by Aayman Khalid
hey, I am working on a udp client-server application where one server is supposed to handle 40 clients which could all be logged on at once as well...Now in "unix" such issues are resolved by using "fork()" function which basically creates a child process to deal with the client and...
19 Apr 2013 by Aayman Khalid
hey I wanted to create an asynchronous/non-blocking udp client server application where the client and server were supposed to chat away with each other without waiting for each other's turns.I came to know that this could be done by select()...here is my Server(Mentioning only the...
10 Oct 2014 by Abbas A. Ali
Hi, I am newer to Java just started it a while back. I am trying to make chat messenger (Client-Server) and I need a data structure in which I can store online users (One socket and one String containing Username). Now I did a lot of research and thought AbstractList could help me decently,...
24 Sep 2012 by Abdul Rehman 2050
If i am not wrong you want to make a chat messenger type application that can work over internet just like gtalk, yahoo, or other IM messengers do ?There are some points to remeber for that. Lets Define some term here so it would be better to understant what i actually want to say A...
20 Sep 2012 by Abedalqader
I'm trying to develop multiplayer game , like any usual games join to room game then the score of game sharing with another player.After I'm searching in Google , what i see i should be start on DatagramSocket , in this link...
31 Jul 2010 by Abhinav S
See here[^] for a sample application.
20 Sep 2010 by Abhinav S
No dont use a loop. Creating a polling sort of a maechanism using a timer.
16 Oct 2010 by Abhinav S
Have a look at the msdn sample here[^].They have used a delegate called EndSend during sending of data.This should be useful to you.They are also using a ManualResetEvent event indicating that the send is done. The next message can be sent after the first one is received and this event...
19 Dec 2010 by Abhinav S
Plenty of information available here[^] (if you are looking for some indepth stuff).
16 Oct 2011 by Abhinav S
msdn.microsoft...
25 Jan 2014 by Abhinav S
Tryhttps://funnel.hasgeek.com/jsfoo2013/759-develop-your-first-multi-room-chat-with-node-js-websockets-and-mongodb[^]https://developer.mozilla.org/en/docs/WebSockets/Writing_WebSocket_client_applications[^]http://www.youtube.com/watch?v=VicWk7S6Jl4[^]http://blog.ilric.org/2011/02/14/super...
17 Feb 2015 by Abhinav S
Links -Sending Files using TCP[^]Creating Simple TCP/IP Server And Client to Transfer Data Using C# / VB.net[^]Video - https://www.youtube.com/watch?v=ujYc6qPgn-8[^]
5 Jan 2012 by Abhishek Nandgaonkar
heyy guys.. m implementing PEER TO PEER FILE TRANSFER..What protocol should I use? TCP or UDP? And why?
5 Jan 2012 by Abhishek Nandgaonkar
Yes, agreed. But what i want is precisely how easy or difficult is it to implement either of the options.Also, if you have an experience of making an application of similar kind, i can get a better answer.
19 Dec 2010 by abrar yousaf
plz help me for socket programing
17 Jan 2011 by ad_robot
Hi Everyone, I'm implementing asynchonous socket programming in (C++, winsock, TCP/IP, based on this example Chat Client Server[^]) at the moment (for data streaming) and am running into problems with missing data when I run the code over a network rather than locally (I only seem to recieve...
14 Jun 2011 by ad_robot
Hey Guys,Excuse the newbie but I was working on a simple sockets program today (from Beej's excellent (book). Everything was working fine but then suddenly the socket refused to bind. Now the bind command constantly returns a -1.I've tried waiting for the socket to free up (as per Beej's...
22 Dec 2014 by Adam Lee
I want to make simple demo in win form like "hello" send from client and server response back to that client. client Server. duplex communication .client ,server both are on different network .I had try to use socket ,web socket. Signal R ,X socket , socket .but i could not resolve...
4 Feb 2012 by Addy Tas
Hi,Sorry to say but no, it is not in the scope of the IP protocol to care about the application it came from. Any decisions should be made on either the Port, IP or content of the data packet.If you are having the trouble that you are handling data from your own app it should be a small...
21 May 2012 by Addy Tas
Hi,If you don't understand this really simple piece of code i doubt you'll get very far but remember; the trip to the answer is the most fun.As I see it all you have to do is:- create a new form, - add a button (might as well call it send), - add a onClicked event, - copy all...
15 Nov 2015 by ADrMD
I am working on an client-server application, where each client is served on a separate thread, i met some issues when running the program, i observed that if client calls Socket.Send before server calls Socket.Receive then server blocks on Socket.Receive forever. When running slowly in debug...
30 Sep 2010 by Aescleal
As CPallini said it sounds like a compiler error. So what exactly is the error you're getting? Eidt the question and cut and paste the whole line you get off your compiler that describes the error.In the meantime there's a line number with the error. Have a look at the line it says the error...
3 Oct 2010 by Aescleal
linayang wrote:this is the "testlist"function which is in "server.cpp"file.Why isn't it in an include file? Unless you're using a compiler based on EDG you can't export a template definition from a source file and just include the prototype somewhere. Whatever calls testlist needs to see...
3 Oct 2010 by Aescleal
As router's a template don't you get an error in main at:Router integerRouter;?Cheers,Ash
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...
5 Feb 2015 by Afzaal Ahmad Zeeshan
If you're having the API to login the user, and to log the user out, then upon a successfull login or logout function call, you can log the data of the user. I am unable to determine what sort of method you're using to store the data (that GUID, and the Time object you're using inside the...
2 Jan 2021 by Afzaal Ahmad Zeeshan
Quote: It runs ok in localhost I would like to run the server on my pc and the client in my girlfriend's pc . If the code works fine, then the next step is to get a static IP for your PC and then connect to the SockServer instance using that IP...
16 Mar 2021 by Afzaal Ahmad Zeeshan
There can be several issues with the code, starting with the encoding of the content. It also depends on what you are sending. In your code, you do not show what the client is sending, only what you are reading on the server-side. It might be...
22 Aug 2021 by Afzaal Ahmad Zeeshan
I already gave you the answer to this question on https://www.codeproject.com/Answers/5310985/How-do-I-make-a-HTML-parser-from-scratch-Python#answer1[^]. Do not repost the question as the answer to your problem remains the same.
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 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.
16 Jan 2014 by agent_kruger
According to me if the network is slow it is obvious that the message receive time would vary. Note : Before telling that the network of client's PC is slow try to ping any website and check if it is really slow or there are little amendments to be made to your code.
6 Feb 2014 by agent_kruger
I have tried to work with sockets which work over LAN but how to use them to transfer data over internet. cannot find a good example please help me?
7 Feb 2012 by ahsan45
Hi , I want to implement chat messenger , can any body here to guide me that in which programming it is easier to implemet it.The messenger is like a Yahoo/Msn Messenger with some extra features which are not in the current Messenger . I just want to know from some expert programmer that it is...
29 Mar 2012 by AJV King
Hi,I am stuck at a place.. is their any way that I can get list of all the available internet connections on the users system...?In simple words: I need list of all available ISP(available on his system) to show the user to connect one.E.g.: User has two ISP connections installed...
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...
25 Feb 2013 by Alamgirable
I am working on a project in which i have to send data in bits.Is it possible to send 1 bit from one computer to another through internet.Most of the people said to me that minimum internet packet size is 64bytes.If i send 1bit from one computer to another then packet bandwidth is 64bytes.
18 Jul 2013 by Alamgirable
I create a client server app,But the client did not receive more 5000 bytes. Please help me.
29 Nov 2010 by Alban Deruaz
Hi everyone!I am having a strange problem when I try to connect to a server using a socket: It works when I do it from my home networks but it fails connecting when I do it from my school's public network which is as you may guess monitored.My code: WSASATA init; ...
29 Nov 2010 by Alban Deruaz
Thank you for your reply.Could you tell me how I can use these transport layer sockets?In fact, I thought that I was already using Winsock. I've searched for that kind of info for a while, I tried some examples but none of them worked. Thanks!
21 Dec 2011 by Albert Holguin
Are they all on the same socket? ...if so, that's probably why you're having this problem. Have you tried having a login-request socket, doing a hand-shake there, then sending clients to their own socket?Alternatively, you can handle this at the application layer by handling all incoming...
19 Jul 2012 by Albert Holguin
From looking at your screen capture, it looks like the project requires the WinPCap[^] library (makes sense since its essentially a library of packet definitions). You need to download the library and install it then add the installation path as one of your default paths or an "additional...
3 Aug 2012 by Albert Holguin
I'll show you the functional steps without code. You should be able to figure out the code.0. Establish socket connection.1. Read the input file in binary mode (for large files, only read in chunks).2. Break up the file into chunks that fit into reasonable packet sizes.3. Transmit...
5 Sep 2012 by Albert Holguin
It's somewhat similar (as far as flow of things), but you have to use some sort of socket library to accomplish this (i.e. sockets aren't built into the language). In Windows, the native library/API is Winsock (or Winsock2) but if you require cross platform sockets, then you'd have to use some...
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...
6 Feb 2014 by Albert Holguin
GUI and sockets have nothing to do with each other. Find a GUI example, find a socket example, implement both, and you have a program with both a GUI and sockets.
7 May 2015 by Albert Holguin
connect(server, (struct sockaddr*)&server, sizeof(server))Looks like you're passing the "server" variable instead of the address structure.
28 Jan 2016 by Albert Holguin
Yes of course, sockets accept a collection of bytes, how those bytes are assembled and where they came from is not their concern, that's the application's problem.
9 Jun 2015 by AldoBlack
Hello,I have 6 devices, price checkers. I have a project which the client in a supermarket will scan a product on this device and it will return the price of the product. I have managed to connect with one device, get the bar code and send data. But I can not seem to do to connect with...
1 Oct 2013 by alex giulio
hello every body!please help me! i want to sync data between gmail and software, but i don't have much knowledge about it. every can help me understand deeply about it, thank so much!
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 -...
2 Dec 2010 by Alexeirob
Conditional accept blocks the accept() for 2-3 seconds even if the connection is ready.I can't remove the conditional accept (3rd party application) and I'm sure that the connection is ready.What can be a solution to that?Thanks in advance.AR
5 Dec 2010 by Alexeirob
Hi Guys,How can I tell if a socket is blocking or non-blocking in C++ and in windows API?Thanks,AR
15 Mar 2010 by ALEXZUPO
I'm looking for a simple example to put in a TextBox a packet sniffer from a UDP socket.Thanks
18 Apr 2014 by Ali Al-Masry
Hello Everyone at CodeProject , as title say i am editing an Online Game Server Socket to make it for the same game but as a client socket , actually i tried it many times but fails , spent more time on that , well ,, here is my idea..Server and client each one have 2 sockets... Login Socket...
24 Oct 2014 by Ali Al-Masry
Hello guys i have a server / client applications ...everything working as well but i got a problem here and i will explainmy client is a Form1 , Form2 and Form3Form1 is the main form it's starts the socket and handling everything ...when the server send a [Start Session] Packet...
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...
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...
5 Mar 2013 by Alistair Budd
I would like to know how WSASend works internally when dealing with multiple WSABUF buffers.Does it loop through each, sending only the data inside the current buffer?OrDoes it combine all the data together before sending?OrAnother method?I am using Overlapped.int nBytesSent...
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...
29 May 2013 by AlphaDeltaTheta
public static void main(String[] args) { ChatApplication program=new ChatApplication(); //calling noarg constructor program.createInterface();}I see, You do all stream initialisation in the parameterized ctor (constructor) but you are calling the default ctor. Every thing is...
29 Feb 2012 by alterer
Hi,I have a client written in C#.It works fine when i try to communicate with a server written in C#.I'm trying to use the same client to communicate with a Server written in C++ and it doesn't seem to work.The connection is made as the server hangs when i say connect on my client and as...
18 Nov 2012 by Amar zaidi
my problem is :i make two programs one server and the second as client the client send files to server but when he receive it the size of received file is bigger than the sent file .and thats the sent code private void send_Click(object sender, EventArgs e){ FileStream fs = new...
26 Nov 2012 by Amar zaidi
i found solution usink Invoker change the server code FileStream fs = new FileStream(@"c:\\jj.wav", FileMode.Create, FileAccess.Write);//creat a receiv file sckt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); sckt.Bind(new...
30 Jun 2012 by Amarnath S
You may be overwhelmed by the amount of information available in books. I find that the best way to learn about these is to take an online (and hopefully free) online course.While I'm yet to come across an online networking course, I find that a seven-week-long online *free* course on...
26 Jul 2012 by Amir Hesami
A library which can get any class you pass to it, convert it to bytes, and send it to the other end.
15 Oct 2015 by amir.nazarizadeh
HiI have a simple chat program in c# with a client and a serverwhen I start the program it give me warning with this message:Additional information: Could not connect to net.tcp://localhost:1234/Chat/ChatService. The connection attempt lasted for a time span of 00:00:02.0986369. TCP...
29 Nov 2011 by amsga
Hi,I was wondering if there is a need to do endian conversions for data being send via sockets in C# or will the underlying calls convert it for you?I was reading up on network byte order I was thinking if this would affect different kinds of data like String, Short and Longs,...
2 Nov 2011 by anak_goblok
hi, I'm new in socketing, I want to ask how can I send and receive data from flash to C#(console program) and from C# to flash. C# as a server and flash as client (many flash client connect to 1 c# program)? (without using XML, only using action script in flash)
12 Nov 2011 by anak_goblok
Is it possible to connect to socket server without knowing the IP address, like auto detecting the active server or something.If it's possible please tell me how to do it.
2 Aug 2023 by Andre Oosthuizen
The problem you are facing is likely related to the way you are handling the data reception. Reading data from the stream using 'stream.Read' may not guarantee that you receive all the data at once, you should modify your code to read from the...
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.
17 Sep 2012 by andrevdcolff
If I'm not completely wrong here I think the problem is encoding.Winsock uses ANSI as a default which in turn I believe on Windows is 1252 and you are converting your string to ASCII which is a different encoding.Try changing your code to rather use the following:Encoding...
17 Jan 2011 by Andrew Brock
A few pointers that you may or may not already know:Remote debugging can be set up by running msvsmon.exe from C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\\msvsmon.exe on the remote computer or VM. This is in the 64-bit Program Files on a 64-bit...
24 Feb 2015 by Andy411
May be I'm wrong, but for me, it looks like you are freeing the memory before assigning the variables like IP_CS.You should free the memory, when you don't need it anymore.printf("\nNow printing each saved string:\n"); for (jj=0; jj printf("String %d: %s\n", jj,...
6 Jun 2015 by Anil Kumar 23
HiI have to implement a socket server which listens to HTTP requests following the HTTP RFC (https://www.ietf.org/rfc/rfc2616.txt), the server should be capable of doing the following: - Exposes a GET API as "api/request?connId=12&timeout=100" - This API will keep the request running...
17 Jan 2013 by animares
Can not connect to the computer from the Internet by using socket, when the computer has Internet connected not directly through a lan card. What to do? If I have a computer podklyuchayus Katori Internet connection directly everything is fine and turns with adaprami of TP-LINK does not work.
17 Jan 2013 by animares
I just want to use socket to connect to a remote computer and send the message (TCP chat). What do you suggest? Port forwarding or put the computer in DMZ zone?
11 Feb 2013 by anjansarma
I am trying to develop a network traffic analyzer for windows platform and implemented on a LAN using java laguage. But I have found problem in using the PCAP library. I have installed PCAP and JPCAP both, but whatever code I try to execute, and error code is displayed that PCAP library is not...