I stepped Back to 4.1 Firmware, SDK, Drivers and so on, same behaviour…
Humour us, can you show us what device capabilities show from mfdeploy?
the SendTo(… and ReceiveFrom(… works in 4.1 while Connect( Send( and Receive( does not.
Back to 4.2 Nothing works
thats my code
IPHostEntry hostadd = Dns.GetHostEntry(TimeServer);
if (0 < hostadd.AddressList.Length)
{
IPEndPoint EPhost = new IPEndPoint(hostadd.AddressList[0], 123);
//Connect the time server
System.Net.Sockets.Socket TimeSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
//TimeSocket.Connect(EPhost);
try
{
// Initialize data structure
Initialize();
Int32 i32DataLength = TimeSocket.SendTo(SNTPData, 0, SNTPData.Length, SocketFlags.None, EPhost);
if (0 < i32DataLength)
{
i32DataLength = TimeSocket.Available;
if (0 < i32DataLength)
{
EndPoint EPAnswer = new IPEndPoint(hostadd.AddressList[0], 123);
i32DataLength = TimeSocket.ReceiveFrom(SNTPData, 0, i32DataLength, SocketFlags.None, ref EPAnswer);
DestinationTimestamp = DateTime.Now;
System.DateTime AktuelleZeit = DateTime.Now.AddMilliseconds(LocalClockOffset);
}
}
}
catch (SocketException e)
{
throw new Exception(e.Message);
}
finally
{
TimeSocket.Close();
}
}
thats what mfdeploy tells:
Pinging... TinyCLR
HalSystemInfo.halVersion: 4.2.0.0
HalSystemInfo.halVendorInfo: Microsoft Copyright (C) Microsoft Corporation. All rig
HalSystemInfo.oemCode: 255
HalSystemInfo.modelCode: 0
HalSystemInfo.skuCode: 65535
HalSystemInfo.moduleSerialNumber: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
HalSystemInfo.systemSerialNumber: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
ClrInfo.clrVersion: 4.2.0.0
ClrInfo.clrVendorInfo: Microsoft Copyright (C) Microsoft Corporation. All rig
ClrInfo.targetFrameworkVersion: 4.2.0.0
SolutionReleaseInfo.solutionVersion: 4.2.4.0
SolutionReleaseInfo.solutionVendorInfo: Copyright (C) GHI Electronics, LLC
SoftwareVersion.BuildDate: Aug 22 2012
SoftwareVersion.CompilerVersion: 410462
FloatingPoint: True
SourceLevelDebugging: True
ThreadCreateEx: True
LCD.Width: 320
LCD.Height: 240
LCD.BitsPerPixel: 16
AppDomains: True
ExceptionFilters: True
IncrementalDeployment: True
SoftReboot: True
Profiling: False
ProfilingAllocations: False
ProfilingCalls: False
IsUnknown: False
I mentioned that example, not to try HTTP.
In that example code I mentioned, it loops reading
IPAddress ip = IPAddress.GetDefaultLocalAddress();
and keeps looping till the IP address is not “0.0.0.0”. They used this to make sure that DHCP lease is granted.
I used
Microsoft.SPOT.Net.NtworkInformation[] ni = Microsoft.SPOT.Net.NtworkInformation.GetAllNetworkInterfaces();
ni[0].EnableDynamicDns();
ni[0].EnableDhcp()
and looped until ni[0].IPAdress was not 0.0.0.0
I added another loop with the mentioned code
IPAddress ip = IPAddress.GetDefaultLocalAddress();
both give me the IPAdress I could connect to from my pc (via HTTP) and that is used in my wireshark logs.
wireshark also shows me the DHCP Protocol, but not UDP only TCP from my Board.
So I can use HTTP(TCP) as server and as client, but UDP packets are not sent.
With 4.1 on the same board i can send UDP
Socket.SendTo(...
Socket.ReceiveFrom(...