About Monkey 2 › Forums › Monkey 2 Projects › linux inet, i2c, v4l2 (videoin) and fb (framebuffer) monkey2 wip
This topic contains 0 replies, has 1 voice, and was last updated by 
 Simon Armstrong 2 years, 8 months ago.
		Viewing 1 post (of 1 total)
	
	- 
		AuthorPosts
 - 
		
			
				
August 4, 2016 at 5:17 am #2729Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586namespace posix#import "<unistd.h>"#import "<sys/ioctl.h>"#import "<sys/types.h>"#import "<sys/socket.h>"#import "<netdb.h>"#import "<errno.h>"#import "<libc>"Using libcexternClass sockaddr Extends VoidEndClass sockaddr_in Extends sockaddrField sin_family:ShortField sin_port:UShortField sin_addr:ULongField pad0:IntField pad1:IntEndClass sockaddr_in6 Extends sockaddrField sin6_family:UshortField sin6_port:UShortField sin6_flowinfo:UIntField sin6_addr:intField sin6_addr1:IntField sin6_addr2:IntField sin6_addr3:IntField sin6_scopeid:IntEndClass addrinfo Extends VoidField ai_flags:Int ' input flagsField ai_family:Int ' protocol family for socketField ai_socktype:Int ' socket typeField ai_protocol:Int ' protocol for socketField ai_addrlen:Int ' length of socket-addressField ai_addr:sockaddr ' socket-address for socketField ai_canonname:char_t ptr ' canonical name for service locationField ai_next:addrinfo ' pointer to next in listendFunction open:Int( path:CString,mode:Int )function ioctl:int( fd:int,request:uint,memory:void ptr)function ioctl:int( fd:int,request:uint,value:int)function read:int( fd:int,buffer:void ptr,count:uint)function write:int( fd:int,buffer:void ptr,count:uint)Function close:Int( fd:int)Function connect:int(sock:Int,addr:sockaddr,addrlen:Int)Function listen:int(fd:Int,backlog:Int)Function bind:Int(fd:Int,addr:sockaddr,addrlen:Int)Function setsockopt:Int(fd:Int,level:Int,name:Int,val:Void Ptr,size:Int)Function accept:Int(fd:Int,addr:sockaddr,addrlen:uInt Ptr)Function recv:Int(fd:int,buffer:Void ptr,BufferSize:int,flags:Int)Function send:Int(fd:int,buffer:Void ptr,BufferSize:int,flags:Int)Function getaddrinfo:Int(hostname:CString, servername:CString, hints:addrinfo, res:addrinfo ptr)Function freeaddrinfo(ai:addrinfo)Function socket:Int(domain:Int,socketType:Int,socketProtocol:Int)Global errno:IntGlobal AF_INET:IntGlobal AF_INET6:intGlobal PF_INET6:intGlobal SOCK_STREAM:intFunction strerror:char_t Ptr(error:Int)PublicFunction ErrorString:String()Local result:=errnoLocal s:=strerror(errno)Return String.FromCString(s)end
Due to a respite in employment conditions I have been continuing to focus on linux pi skills and knowledge.
https://github.com/nitrologic/m2/tree/master/vhost
I suspect some subtle difference between linux and macos on the socket front but am happy with the basic tcp and udp implementations.
It is interesting to see what works in ipv6 and what doesn’t so there is still some stuff to do on the socket encapsulation.
 - 
		AuthorPosts
 
		Viewing 1 post (of 1 total)
	
	You must be logged in to reply to this topic.