Click here to Skip to main content
15,897,291 members

UDP Socket Programming

20038427 asked:

Open original thread
I am using UDP Server which receives data through port 50001. I used wireshark to monitor the data. Here the data what i receive in UDP server buffer and what data is showing in wireshark is not matching fully . but some places it is matching exactly ...What could be the reason for this? here is the receiver code for UDP server

C++
char mesg[50];


n=recvfrom(sockfd,mesg,50,0,(struct sockaddr*)&cliaddr,&len);
fwrite(mesg,1,50,fp);



the values whatever is coming from client should be in the range of 3000 to -3000 but in some places it is going to 30000 to -30000. In wireshark i plotted that values it is coming exactly in 3000 to -3000 range. but if i plot the received buffer it is giving in the range of 3000 to -3000 but also more values are in the range of 30000 to -30000
Tags: C++, C, VC++, MFC

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900