473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Socket Programming

Dear All,

I am new in this forum and also relatively new to .Net. I need to create an application which needs to be able to act as a network server and provide data and messages to a variety of clients including IMAP email clients.

I am using Visual C# and .Net version 2.0.

The .NET socket interface looks somewhat easy but it there seems little control of the details. I can not design both sides of the network comm, i.e. my server must be able to connect to any TCP client written by whoever - so I must can not implement simple application layer protocols but rather must rely only on for example what the IMAP or HTTP RFCs say.

Two key problems I would like some help with is:

(1) I need network events so that I can initiate a READ on sockets when network data arrives. Having to get a thread looping all the time to check seems wasteful to me. I cannot find any such network event.

(2) I am getting / sending limited size messages (i.e. it's not Megabytes) over the network but can not include total message size into the data. However, TCP/IP knows when all the packets of a certain messages have been transmitted and the transmission of that specific message is completed and acknowledged as far as TCP is concerned. However, this info seems unavailable on the programmer level in .NET. Or isnt it?
I can keep checking for socket.Available() in my code but I must know that a specific message is now over, and that the next data now Available() is actually a new message.

I already searched MSDN and the .NET Help but seems nothing documented.
Any hint is appreciated.

Regards

Peter
Mar 13 '08 #1
2 817
debasisdas
8,127 Expert 4TB
Question moved to .NET forum.
Mar 13 '08 #2
Plater
7,872 Expert 4TB
TCP/IP provides mechanisms to ensure all bytes sent out arrive at their destination and in the correct order.
It does not specifically know how many of those bytes are associated with one .Send() call vs another.
That is were the protocals come in.
Both IMAP and HTTP have delimantors to know when a message is over.
HTTP also has a special header (IMAP may have one too but I haven't done a lot of IMAP) that tells you have many bytes are going to be in the message.

Your socket handling will be capable of knowing that MessageA came from computer1 and MessageB came from computer2 (RemoteEndPoint)
Mar 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: pyguy2 | last post by:
Issues of socket programming can be wierd, so I'm looking for some comments. In my python books I find exclusive use of socket.close(). From my other readings, I know about a "partial close...
5
by: John Sheppard | last post by:
Hi all, I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose...
1
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows...
5
by: mscirri | last post by:
The code below is what I am using to asynchronously get data from a PocketPC device. The data comes in fine in blocks of 1024 bytes but even when I send no data from the PocketPC constant blocks of...
2
by: djc | last post by:
I read a network programming book (based on framework 1.1) which indicated that you should 'never' use the RecieveTimeout or the SendTimeout 'socket options' on TCP sockets or you may loose data. I...
10
by: Uma - Chellasoft | last post by:
Hai, I am new to VB.Net programming, directly doing socket programming. In C, I will be able to map the message arrived in a socket directly to a structure. Is this possible in VB.Net. Can...
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
0
by: shonen | last post by:
I'm currently attempting to connect to a shoutcast server pull down the information from here and then I'll parse it. I got this working with the httplib, which was great, the problem is I want...
8
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi all, I am new to .net technologies. ASP.NET supports socket programming like send/receive in c or c++? I am developing web-site application in asp.net and code behind is Visual C#. In...
3
by: Stuart | last post by:
I am in the process of teaching myself socket programming. I am "playing around" with some simple echo server-client programs for m the book TCP/IP Sockets in C. The Server program is: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.